Skip to content

Latest commit

 

History

History
103 lines (62 loc) · 5.39 KB

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

File metadata and controls

103 lines (62 loc) · 5.39 KB

Use Azure PowerShell to [task]

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.

Prerequisite: Install a Recent Version of Azure PowerShell

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:

[AZURE.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""

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]

Script Examples

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

  • [short verb, uses, has, is, etc]
  • [next 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