Skip to content

Latest commit

 

History

History
100 lines (65 loc) · 5.46 KB

virtual-machines-ps-template-compare-sm-arm-task.md

File metadata and controls

100 lines (65 loc) · 5.46 KB

Use Azure PowerShell to [task]

This article shows you how to [task] by using Azure and Azure Resource Manager module commands. This is intended to help you learn the new commands and migrate existing scripts to the new commands.

Prerequisite: Install a Recent Version of Azure PowerShell

If you still need to do so, install at least the [version number] version of Azure PowerShell on your local computer. Using an earlier version will have different Azure Resource Manager cmdlets described in this article. For details, see:

Note

Most tasks require you to use an administrator-level Azure PowerShell command prompt.

Command Comparison

This [table | section] shows the command syntax.

These command examples use the following variables:

$FriendlyName"<Describe value>"

Service Management Resource Manager
syntax syntax

[Short intro sentence about the command. Omit if there's nothing to say. But if it uses approaches such as the pipeline, explain that]:

[command string]

Script Examples

Here's an example that uses [cmdlet names)] to [task]. It includes commands that:

  • [short verb, uses, has, is, etc.]
  • [following short verb]
It includes the following variables:
  • [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

Additional Resources

Manage Availability

Virtual machines documentation