azure, virtual machines

Assigning a Static IP Address on an Azure VM

Quick tip: if you need to set a static IP address on a VM running in Azure you can use the following snippets at the Azure Powershell:


# Determine whether the target IP address is in use on Virtual Network "SPnet"
Test-AzureStaticVNetIP –VNetName SPnet –IPAddress 10.0.0.5

# Give machine "sp1" running on azure service "XXX" a static IP address of 10.0.0.5
# Note that I had the VM switched off when I did this. I'm not clear on whether that's necessary -  the machine may need a reboot if its on
Get-AzureVM -ServiceName XXX -Name sp1 | Set-AzureStaticVNetIP -IPAddress 10.0.0.5 | Update-AzureVM

I’m not actually sure if it’s possible to just switch DHCP off on the machine directly. It occurs to me that it might work, but because the azure network infrastructure won’t know that machine is bagging it’s own IPs, it might get upset.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s