Tag: connect

Azure Arc enabled SQL Server

How to add an Azure Arc enabled SQL Server

A couple of months ago Microsoft announced a new Hybrid Cloud feature called Azure Arc enabled SQL Server. Azure Arc enabled SQL Server allows you to manage your global inventory of SQL servers, protect SQL Server instances with Azure Security Center or periodically assess and tune the health of your SQL Server configurations. In this blog post, we will cover how you can add SQL Server to Azure Management using Azure Arc.

Azure Arc enabled SQL Server Architecture

Azure Arc enabled SQL Server Architecture

Prerequisites

Before you add an Azure Arc enabled SQL Server, you need to prepare the following prerequisites:

  • A virtual or physical machine running SQL Server. The machine hosting SQL Server must be connected to the internet directly or via a proxy server. Running one of the following operating systems:
    • Windows Server 2012 R2 and higher
    • Ubuntu 16.04 and 18.04 (x64)
    • CentOS Linux 7 (x64)
    • SUSE Linux Enterprise Server (SLES) 15 (x64)
  • The Connected Machine agent communicates outbound securely to Azure Arc over TCP port 443. If the machine connects through a firewall or a HTTP proxy server to communicate over the Internet, review the network configuration requirements for the Connected Machine agent.
  • A user account with permissions (An user account with local admin rights.
  • Azure PowerShell installed on the computer executing the onboarding script.
  • You need to have the “Microsoft.AzureData” provider namespace registered. You can run the following Azure PowerShell command to do that: “Register-AzResourceProvider -ProviderNamespace Microsoft.AzureData”. You can run that command in Azure Cloud Shell.

To learn more about the prerequisites, check out the following Microsoft Docs page.



Connect Azure Cloud Shell to virtual network vNet

Connect Azure Cloud Shell to Virtual Network vNet

As you know, Azure Cloud Shell is a great management tool to manage your Azure resources. Azure Cloud Shell is an interactive, authenticated, browser-accessible shell for managing Azure resources. It provides the flexibility of choosing the shell experience that best suits the way you work, either Bash or PowerShell. You can learn more about Azure Cloud Shell here. If you wanted to manage Azure resources such as Azure virtual machines (VMs), you needed to connect to a public IP address of a virtual machine, which really didn’t work in all scenarios. With the latest update, you can now connect Azure Cloud Shell to an Azure virtual network (vNet). With the new method, you can now deploy the Azure Cloud Shell container within your virtual network (vNet), which now allows you to use PowerShell remoting, SSH, or other command-line tools such as kubctl using private IP addresses.

Requirements

Before you can use Cloud Shell in your own Azure Virtual Network, you will need to create some resources to support this functionality. 

  • Virtual Network – The virtual network in which the resources are located you want to manage or the network that peers with a virtual network where your Azure resources are.
  • Subnet – In that virtual network you will need a dedicated subnet to host Cloud Shell containers.
  • Network profile
  • Azure Relay – An Azure Relay allows two endpoints that are not directly reachable to communicate.
  • Storage Account – The storage account needs to be accessible from the virtual network that is used by Cloud Shell.

There are also some considerations you need to be aware of, such as currently supported Azure regions during the preview, Azure Relay adds additional cost and slower startup speed of Cloud Shell containers. You can learn more about the requirements here.

Connect Azure Cloud Shell to a virtual network

To make the deployment easy, there are Azure Resource Manager templates available to deploy the necessary network and storage resources. In my step by step guide, I already have a virtual network deployed within my subscription with the resources I manage. If you don’t have that yet, and you want to try this out, you will need to create a resource group and a virtual network.

Simply the deploy the following two templates:

Deploy Azure Cloud Shell Network ARM template

Deploy Azure Cloud Shell Network ARM template

You can get the Azure Container Instance OID by running the following command:

Get-AzADServicePrincipal -DisplayNameBeginsWith 'Azure Container Instance'

Also, make sure that the subnet ranges are part of the address range in your virtual network.

Reconnect Cloud Shell

If you have used Azure Cloud Shell before, you will need to reconnect that to the specific resources. You can simply run the command “cloudrive unmount” or “dismount-cloudrive”.

After that you can reconnect your Cloud Shell and select the isolated network option. Keep in mind this feature is currently in preview, and only available in West US and West Central US.

Connect Azure Cloud Shell to virtual network

Connect Azure Cloud Shell to virtual network

This will then take a moment to deploy.

Requesting a container

Requesting a container

After the Cloud Shell container is deployed within the virtual network, you can now start using private IP addresses within that virtual network or virtual networks that are peered.

SSH into Azure VM with Private IP address from Cloud Shell

SSH into Azure VM with Private IP address from Cloud Shell

I hope this blog gives you a short overview of how you can integrate Cloud Shell in your private Azure virtual network. If you have any questions, feel free to leave a comment.



List Azure Arc Machines Agent Version in Azure Cloud Shell

Get the Azure Connected Machine Agent (Azcmagent) Version

Azure Arc Enabled Servers just got another update enabling extensions. This also includes an updated version of the Azure Arc agent or Azure Connected Machine Agent (Azcmagent). To get an overview of what Azure Arc Azure Connected Machine Agent is installed on your machines, you can use several different ways. In this blog post, we are going to have a look at how you can get installed Azure Connected Machine Agent (Azcmagent) version for Azure Arc Enabled Servers.

On the Azure Arc Enabled Server

If you want to check the Azure Connected Machine Agent (Azcmagent) version directly on your Azure Arc enabled server, you can simply run the following command in PowerShell.

azcmagent version

This will list the installed version.

Azure Connected Machine Agent azcmagent Version

Azure Connected Machine Agent azcmagent Version

In the Azure Portal

You can also see the agent version in the Azure Portal. If you browse to your Azure Arc Enabled Server, you can find the agent version on the overview page.

Azure Portal - Azure Arc Enabled Server

Azure Portal – Azure Arc Enabled Server

However, if you want to see the agent version for your Azure Arc enabled servers at scale, this isn’t an ideal option.

List Azure Connected Machine Agent (Azcmagent) version for all Azure Arc machines

If you want to see the installed Azure Connected Machine Agent (Azcmagent) version for all your Azure Arce enabled servers at scale, you can use Azure Resource Graph Queries.

This query lists all the Azure Arc enabled machines and shows the installed agent version.

List Azure Arc Machines with Agent Version

List Azure Arc Machines with Agent Version

You can run the following query in the Azure Resource Graph Explorer in the Azure Portal.

 resources
| where type == "microsoft.hybridcompute/machines"
| extend agentversion = properties.agentVersion
| project name, agentversion, location, resourceGroup, subscriptionId
| order by name

You can also run the query directly in Azure Cloud Shell or on your local machine using Azure PowerShell or the Azure CLI.

List Azure Arc Machines Agent Version in Azure Cloud Shell

List Agent Version in Azure Cloud Shell

Azure CLI

az graph query -q "Resources | where type =~ 'microsoft.hybridcompute/machines' | extend agentversion = properties.agentVersion | project name, agentversion, location, resourceGroup, subscriptionId"

Azure PowerShell

Search-AzGraph -Query "Resources | where type =~ 'microsoft.hybridcompute/machines' | extend agentversion = properties.agentVersion | project name, agentversion, location, resourceGroup, subscriptionId"

If you need an overview of what Azure Connected Machine Agents we have installed and which versions do exist in our environment, you can just use the following Azure Resource Graph query.

Azure Resource Graph Explorer Chart - Azure Arc Server Agent Version

Azure Resource Graph Explorer Chart

Azure Resource Graph Explorer

 resources
| where type == "microsoft.hybridcompute/machines"
| extend agentversion = properties.agentVersion
| summarize count() by tostring(agentversion)

Azure PowerShell

Search-AzGraph -Query "Resources | where type =~ 'microsoft.hybridcompute/machines' | summarize count() by tostring(properties.agentVersion)"

Azure CLI

az graph query -q "Resources | where type =~ 'microsoft.hybridcompute/machines' | summarize count() by tostring(properties.agentVersion)"

Conclusion

I hope this blog post provides you with a short overview of how you can make sure which agent versions you have installed on your Azure Arc enabled servers. To learn more about Azure Arc for servers, check out Microsoft Docs. If you have any questions, feel free to leave a comment.



Connect Ubiquiti UniFi Dream Machine to Azure VPN

Connect Ubiquiti UniFi Dream Machine to Azure VPN

A couple of days ago I got a Ubiquiti UniFi Dream Machine, which is an all-in-one device with an access point, 4-port switch, and a security gateway. After the basic setup, I wanted to connect my Ubiquiti UniFi Dream Machine USG to an Azure VPN Gateway (Azure Virtual Gateway), using Site-to-Site VPN. In this blog post, I am going to show you how you can create a site-to-Site (S2S) VPN connection from your Ubiquiti UniFi Dream Machine to Azure Virtual Network Gateway.

Azure Virtual Network Gateway and Connection

I already have a virtual network in Azure with the address space 10.166.0.0/16, and I also deployed the Azure Virtual Network Gateway connected to that vNet. The next thing I did was to add a connection to the gateway.

Azure VPN Connection

Azure VPN Connection

You need the following:

  • Name for the connection
  • Set Connection type to Site-to-site (IPSec)
  • Create a local network gateway (basically the configuration of your local VPN gateway.
  • Define a shared secret

Configure Ubiquiti UniFi Dream Machine VPN connection

Now you can switch to your UniFI Dream Machine, which has an UniFI USG integrated. Under settings go to Networks and click on Create new Network

UniFi Network Azure VPN

UniFi Network Azure VPN

Here you configure the following:

  • Name of your VPN connection
  • VPN Type Manuel IPSec
  • Remote Subnets which is the Azure vNet address space (in my case 10.166.0.0/16)
  • Peer IP which is the public IP address of the Azure virtual network gateway
  • Local WAN IP
  • the pre-shared key (shared secret)
  • IPSec Profile: Customized
  • Key Exchange Version: IKEv2
  • Encryption: AES-256
  • Hash: SHA1
  • DH Group: 2

After that, the VPN will connect and the status of your Azure virtual network gateway connection will change to connected.

Dream Machine Azure VPN Connection

Dream Machine Azure VPN Connection

You can now reach your Azure virtual machine using the private IP address range.

Connected Azure VPN

Connected Azure VPN

I hope this was helpful and show you how you can connect a Ubiquiti Unifi Dream Machine (USG) to an Azure Virtual Network using a site-to-site VPN connection. If you want to learn more about Azure Virtual Network Gateways check out the following documentation:

If you want to know more about point-to-site VPN connection to Azure check out my blog posts:

If you have any questions, feel free to leave a comment.



Import MSOnline PowerShell Module

Manage Windows Azure AD using Windows PowerShell

Well I am a huge fan of Microsoft Office 365 and we are not only using this in our company, I am also using Office 365 for my mothers restaurant. It helps us organzise stuff very easily and allows us to work from everywhere. Now the great thing about using Office 365 and Windows Azure Active Directory it that I can manage it with the same management tools I also use for my on-premise Active Directory. My favorit is of course Windows PowerShell.

To manage Windows Azure Active Directory with PowerShell, where also your Office 365 users are stored, you have to do some simple steps.

First make sure you have installed the .NET Framework 3.5 on your management machine.

Enable-WindowsOptionalFeature -FeatureName NetFx3

Install Microsoft Online Services Sign-in Assistant: Install the appropriate version of the Microsoft Online Services Sign-in Assistant for your operating system from the Microsoft Download Center. Microsoft Online Services Sign-In Assistant for IT Professionals RTW.

Install Windows Azure AD Module for Windows PowerShell: Install the appropriate version of the Windows Azure AD Module for Windows PowerShell for your operating system from the Microsoft Download Center:

Import the MSOnline Windows PowerShell module

Import-Module MSOnline

Import MSOnline PowerShell Module

Connect to your Windows Azure Active Directory Tenant or your Office 365 Tenant:

Connect-MsolService

This will open a popup windows where you have to enter your credentials.

Now now you can start working with your Windows Azure Active Directory.

Connect Windows Azure AD via PowerShell



Microsoft Virtual Machine Converter Solution Accelerator Beta

Hyper-V R2 SP1

Microsoft released a beta of a new Solution Accelerator called “Microsoft Virtual Machine Converter”. The Converter helps you to migrate Virtual Machines from VMware vSphere to Microsoft Hyper-V.

About the Microsoft Virtual Machine Converter Solution Accelerator

The Microsoft Virtual Machine Converter (MVMC) provides a Microsoft-supported, freely available, standalone solution for converting VMware virtual machines (VMs) and VMware virtual disks (VMDKs) to Hyper-V virtual machines and Hyper-V virtual hard disks (VHDs). MVMC supports converting virtual machines using the following guest operating systems:

  • Windows Server 2003 with Service Pack 2
  • Windows Server 2003 R2 with Service Pack 2
  • Windows Server 2008 R2
  • Windows 7

The Microsoft Virtual Machine Converter converts VMware virtual machines created with:

  • VMware vSphere 4.1
  • VMware vSphere 5.0

To virtual machines for:

  • Windows Server 2008 R2 SP1 Hyper-V
  • Microsoft Hyper-V Server 2008 R2 SP1

The Microsoft Virtual Machine Converter:

  • Provides a quick, low-risk option for VMware customers to evaluate Hyper-V
  • Converts the virtual disks and the VMware VMs configuration, such as memory, virtual processor, and other machine settings from the source
  • Uninstalls the VMware tools on the source VM and installs the Hyper-V Integration Services as appropriate
  • Includes an easy-to-use wizard-driven GUI simplifying VM conversion
    Supports offline conversions of VMware virtual hard disks (VMDK) to a Hyper-V based virtual hard disk file format (VHD)
  • Includes a scriptable Command Line Interfaces (CLI) for performing machine conversion and offline disk conversion which integrates with datacenter automation workflows, such as those authored and executed within System Center Orchestrator. The command line can also be invoked through PowerShell.

 

Check it out on Microsoft Connect: https://connect.microsoft.com/site14/MVMC



office365 powershell

Office 365 – How to connect with Powershell

In Office 365 you can do and automate a lot with Windows Powershell. Now this small post shows you how you can connect to Office 365 with Powershell.

  1. Install the Microsoft Online Services Sign-In Assistant
    32-bit
    64-bit
  2. Install the Microsoft Online Services Module for Windows PowerShell
    32-bit
    64-bit
  3. Open Powershell and import the MsOnline Module or use the desktop shortcut which was created by the installer.
    Import-Module MsOnline
  4. Connect to your Microsoft Office 365 account
    Connect-MsolService

    Use your Office 365 LiveID to login (for example [email protected])

  5. Now you can start working with Windows Powershell in your Office 365 account, if you need some more help about the available Powershell cmdlets you can list them with
    Get-Command -Module MsOnline