Archive for the ‘Azure’ Category

Azure Powershell Part 2-Create VM

June 7, 2016

in previous post “Azure Powershell Part 1” we setup and establish a connection to Azure through Powershell, now we try to create a new VM in Azure

after we established the connection and entered relevant subscription information my your session you will be able to run from here

Step 1: Determine the ImageFamily
First you need to determine the ImageFamily or Label value for the specific image corresponding to the Azure virtual machine you want to create. You can get the list of available ImageFamily values with this command.

there is a bunch of Images out there and total list of ImageFamily you can get with Get-AzureVMImage | select ImageFamily –Unique


Once you identified the image you want to deploy, copy the ImageFamily name for next step

$family="<ImageFamily value>"
$image=Get-AzureVMImage | where { $_.ImageFamily -eq $family } | sort PublishedDate -Descending | select -ExpandProperty ImageName -First 1

In my scenario I will use “Windows Server 2012 R2 Datacenter” please pay attention


Please note in some cases, the image name is in the Label property instead of the ImageFamily value. If you didn’t find the image that you are looking for using the ImageFamily property, list the images by their Label property with this command –> Get-AzureVMImage | select Label –Unique

Step 2: Build your command set for VMDeploy
Build the rest of your command set by copying the appropriate set of blocks below into your new text file or the ISE and then filling in the variable values and removing the < and > characters

$vmname="<machine name>"
$vmsize="<Specify one: Small, Medium, Large, ExtraLarge, A5, A6, A7, A8, A9>"
$vm1=New-AzureVMConfig -Name $vmname -InstanceSize $vmsize -ImageName $image

the value vmsize basically defines the instance class with which you classify the hardware properties of your VM. more details on “Sizes for Cloud services” 

now I want to connect this VM to a existing VMSubnet and assign also a static IP. Get-AzureVNetConfig returns back a XML structure, to get more data you can use fl to see what contains inside the XML


here I see I have a VMSubnet called “MyLabNetwork” and CIDR is (Class A). checking which IPs are available you can use Test-AzureStaticVNetIP run following query


good state, so we now know VMSubnet name, subnet range and we confirmed the IP is available

so all together total script to deploy new VM would look like this

###Step1 Add your Account
$userName = "<your organizational account user name>"
$securePassword = ConvertTo-SecureString -String "<your organizational account password>" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)
Add-AzureAccount -Credential $cred
###Step1 END

###Step2 Set your subscription and storage account
$subscr="<subscription name>"
$staccount="<storage account name>"
Select-AzureSubscription -SubscriptionName $subscr –Current
Set-AzureSubscription -SubscriptionName $subscr -CurrentStorageAccountName $staccount

###Step2 END

###Step3 – Determine ImageFamily and Build VMDeploy CommandSet
$family="Windows Server 2012 R2 Datacenter"
$vm1=New-AzureVMConfig -Name $vmname -InstanceSize $vmsize -ImageName $image
$cred=Get-Credential -Message "Type the name and password of the local administrator account."

$vm1 | Add-AzureProvisioningConfig -Windows -AdminUsername $cred.Username -Password $cred.GetNetworkCredential().Password
Test-AzureStaticVNetIP –VNetName "MyLabNetwork" –IPAddress
$vm1 | Set-AzureStaticVNetIP -IPAddress
$vm1 | Set-AzureSubnet -SubnetNames "MyLabNetwork"

###Step3 END


till here, we “only” passed the values but didn’t really create the VM, the final command New-AzureVM is required to kick on the real deployment in Azure

New-AzureVM –ServiceName "<short name of the cloud service>" -VMs $vm1


Once deployment started you will see it in your Azure dashboard



more parameters are available for New-AzureVM commandlet here

Parameter Set: ExistingService

New-AzureVM -ServiceName <String> -VMs <PersistentVM[]> [-DeploymentLabel <String> ] [-DeploymentName <String> ] [-DnsSettings <DnsServer[]> ] [-InternalLoadBalancerConfig <InternalLoadBalancerConfig> ] [-ReservedIPName <String> ] [-VNetName <String> ] [-WaitForBoot] [ <CommonParameters>]

Parameter Set: CreateService

New-AzureVM -ServiceName <String> -VMs <PersistentVM[]> [-AffinityGroup <String> ] [-DeploymentLabel <String> ] [-DeploymentName <String> ] [-DnsSettings <DnsServer[]> ] [-InternalLoadBalancerConfig <InternalLoadBalancerConfig> ] [-Location <String> ] [-ReservedIPName <String> ] [-ReverseDnsFqdn <String> ] [-ServiceDescription <String> ] [-ServiceLabel <String> ] [-VNetName <String> ] [-WaitForBoot] [ <CommonParameters>]

Password need to comply with following security standards else deployment will fail because of password policy, also only following usernames “Admin1, Administrator, Admin”"…” can be used. to use custom admin names you need to use Add-AzureProvisioningConfig -Windows -AdminUsername "<Custom Admin Username>" -Password <YOURPASSWORD>

if you modify $creds you have to pass that again to VMs config

$vm1 | Add-AzureProvisioningConfig -Windows -AdminUsername "<Custom Admin Username>" -Password <YOURPASSWORD>


Quick Tipp, in case you run into any issues during deployment of VM you can use –debug which helps to determine why deployment is failing to proceed

Windows Azure Management Cmdlets

Sizes for Cloud Services

Azure Limits and Quotas

Should I choose cloud services or something else?

there are tons of options available when you are creating Virtual Machine in Azure like a.e Domain Join, additional disk, StaticIP (DIP) for more details around configuration possibilities check out the commandlet “Add-AzureProvisioningConfig”

Azure Powershell Part 1-Setup and Start

June 7, 2016

Using Powershell in Azure is a powerful and quick way to script and automate frequent coming tasks. starting with Azure Powershell there some pre-requisites, I won’t go into much details here but basically how to load / install the Azure Powershell module can be found here

Once you successfully installed Azure Powershell on your machine you can do have a bunch of new commands available


To get a better overview of all commandlets related to a specific module you can use a.e. Get-Command -Module Azure


Now we have to connect to Azure and set up subscription data so we have a connection to Azure

Step 1: Add your account
1.At the PowerShell prompt, type Add-AzureAccount and click Enter.
2.Type in the email address associated with your Azure subscription and click Continue.
3.Type in the password for your account.
4.Click Sign in.


you can do this interactively or you can script that

$cred = Get-Credential 
Add-AzureAccount -Credential $cred


or to automate this in a script to avoid pop-up you can also use

$userName = "<your organizational account user name>" $securePassword = ConvertTo-SecureString -String "<your organizational account password>" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword) Add-AzureAccount -Credential $cred

Note: take security considerations into account when hard coding service accounts / passwords. consider decrypt/encrypt password in your scrip runtime

Step 2: Set your subscription and storage account

Set your Azure subscription and storage account by running these commands at the Windows PowerShell command prompt. Replace everything within the quotes, including the < and > characters, with the correct names.

$subscr="<subscription name>" $staccount="<storage account name>" Select-AzureSubscription -SubscriptionName $subscr –Current Set-AzureSubscription -SubscriptionName $subscr -CurrentStorageAccountName $staccount

You can get the correct subscription name from the SubscriptionName property of the output of the Get-AzureSubscription command. You can get the correct storage account name from the Label property of the output of the Get-AzureStorageAccount command after you run the Select-AzureSubscription command

Microsoft Azure

June 7, 2016

Microsoft Azure, formerly known as Windows Azure, is Microsoft’s public cloud computing platform. It provides a range of cloud services, including those for compute, analytics, storage and networking. Users can pick and choose from these services to develop/test/stage and scale up/down new applications, or run existing applications, in the public cloud.

Microsoft Azure is widely considered both a Platform as a Service (PaaS) and Infrastructure as a Service (IaaS) offering.

I’m fascinated how fast and how quick the offerings are growing inside Microsoft Azure and also what fancy things you can do on a really easy and simple way. especially looking around the network section in Azure it is amazing how you can setup complex network scenarios without having deep networking knowledge.

Below are some quick links around Azure and I will start blogging around Azure Powershell, Azure Networks and Platforms soon, please stay tuned

Microsoft Contributes Next Generation Server Design to Open Compute Project:   
Building and Managing Cloud-Scale Data Centers:  
How Microsoft Designs its Cloud-Scale Servers:  
Azure Fault Domain and Upgrade Domain Explained for IT Pros:   
Manage the Availability of Azure Virtual Machines:  
Azure Fabric Controller Internals: Building and Updating High-Availability Apps:   
Azure Regions:   
Azure Services by Region:   
Developer Notes for Azure in China Applications:   
Manage the Availability of Virtual Machines:  
Traffic Manager and Availability:   
Disaster Recovery and High Availability for Azure Applications:   

Design Azure virtual networks, networking services, DNS, DHCP, and IP addressing configuration
Virtual Network Overview:
Configure a VNet-to-VNet connection by using Azure Resource Manager and PowerShell
Create a VNet with a Site-to-Site VPN connection using the Azure Portal and Azure Resource Manager
Configure a Point-to-Site connection to a virtual network using PowerShell
How to manage DNS Zones using PowerShell
Create DNS zones and record sets using the .NET SDK
Create DNS record sets and records by using the Azure portal
Classless Inter-Domain Routing:  
How to change TCP idle timeout settings for load balancer
Log analytics for Azure Load Balancer (Preview)
Understanding Load Balancer probes
Create and modify an ExpressRoute circuit
Create and modify routing for an ExpressRoute circuit
Create a Virtual Network for ExpressRoute in the classic portal
Configure a virtual network gateway for ExpressRoute using Resource Manager and PowerShell

Introduction to Microsoft Azure Networking Technologies and What’s New:  
A Records, CNAME, and Using DNS with Windows Azure Web Sites (WAWS):

Understanding Azure – A Guide For Developers – An Official eBook Guide from Microsoft

May 18, 2016

Microsoft has released the latest Developers Guides on Azure eBook –. It covers the latest Azure platform services such as Azure Functions, Azure Service Fabric and Azure IoT application development. It’s FREE and you can get it from the link below. It’s a very good resource for developers who want to learn and keep up with the latest Azure technologies and best practices!


more free ebooks around Azure

Developing big data solutions on Microsoft Azure HDInsight – eBook

Microsoft Azure Essentials – Fundamentals of Azure

Microsoft Azure Essentials – Migrating SQL to Azure

Microsoft Azure Essentials: Azure Machine Learning

Planning and Preparing for Microsoft SharePoint Hybrid

The Security Development Lifecycle

Microsoft System Center Data Protection for the Hybrid Cloud

any my favorite Smile 

TCP/IP Fundamentals for Microsoft Windows 

Full ebook Gallery around Microsoft Technologies can be found here

Free ebooks from the MVA Academy here