Azure – Powershell Static IP VNetIP

Recently I’ve been playing with Azure and it’s command line friends including Azure PowerShell. And it’s been a fun journey with Domain Controllers, Virtual Networks, SQL Server (every time) and some websites. This post assumes some knowledge of Azure and PowerShell.

As part of my trip I needed to provision a static VNET IP, a local private IP in the Azure cloud that would not change, and this is the result of that journey..

Resources

Firstly we’ll need to get the Azure PowerShell CommandLets:

http://azure.microsoft.com/en-us/downloads/#cmd-line-tools

We’ll need the tools at the bottom of the page, Install as below:










Modules

#Open up a Microsoft Azure PowerShell Window with run as administrator then
Get-AzureVM -ServiceName <your name>| Stop-AzureVM
Create a folder on C: called Azure
Import-Module Azure
Get-AzurePublishSettingsFile

#Save the .publishsettings file to C:Azure
Import-AzurePublishSettingsFile “C:Azure<the name of your .publishsettings file in the directory>”

(The AzurePublishSettingsFile is sensitive)

Subscriptions (More than one, you’ll need to select)

You can view your subscriptions with, as below and included:

Get-AzureSubscription | Format-Table

#If you have more than one Azure Subscription then you can show them and select one
Get-AzureSubscription | Format-Table

#Choose the relevant Subscription for the Machine
Select-AzureSubscription “<subscription name>”

In the above example the “<subscription name>” could be “Visual Studio Premium with MSDN”

Finale

Get-AzureVM -servicename <your name>|  |Set-AzureStaticVNetIP -IPAddress “172.16.0.4” | Update-AzureVM
Get-AzureVM -ServiceName <your name>| | Start-AzureVM

Above replace “172.16.0.4” with the desired VNet IP.

My Takeaway: Play with Azure

 

Azure – Powershell Static IP VNetIP

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest