This article shows you how to [task], using commands from both the Azure module and the Azure Resource Manager module. This is intended to help you learn the new commands as well as migrate existing scripts to the new commands.
If you haven't done so already, install at least the [version number] version of Azure PowerShell on your local computer. If you use an earlier version, it won't have the Azure Resource Manager cmdlets described in this article. For details, see:
- How to install and configure Azure PowerShell for instructions on setting up Azure PowerShell.
- Using Windows PowerShell with Resource Manager for basics on using Resource Manager.
[AZURE.NOTE] Most tasks require you to use an administrator-level Azure PowerShell command prompt.
This [table | section] shows the command syntax.
These command examples use the following variables:
$FriendlyName""
Service Management | Resource Manager |
---|---|
syntax |
syntax |
[Short intro sentence about the command. Omit if there's really nothing to say. But if it uses approaches such a the pipeline, explain that]:
[command string]
Here's an example that uses [cmdlet names)] to [task]. It includes commands that:
- [short verb, uses, has, is, etc]
- [next short verb]
- [variable 1]
- [variable 2]
$family="Windows Server 2012 R2 Datacenter"
$image=Get-AzureVMImage | where { $_.ImageFamily -eq $family } | sort PublishedDate -Descending | select -ExpandProperty ImageName -First 1
$vmname="AZDC1"
$vmsize="Medium"
$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.GetNetworkCredential().Username -Password $cred.GetNetworkCredential().Password
$vm1 | Set-AzureSubnet -SubnetNames "BackEnd"
$vm1 | Set-AzureStaticVNetIP -IPAddress 192.168.244.4
$disksize=20
$disklabel="DCData"
$lun=0
$hcaching="None"
$vm1 | Add-AzureDataDisk -CreateNew -DiskSizeInGB $disksize -DiskLabel $disklabel -LUN $lun -HostCaching $hcaching
$svcname="Azure-TailspinToys"
$vnetname="AZDatacenter"
New-AzureVM –ServiceName $svcname -VMs $vm1 -VNetName $vnetname