Azure currently has two modes of operation: ASM and ARM.
In the domestic azure, we are all using ASM mode. However, this model has many limitations, such as that each VM must have a public address, deployment cannot be deployed in bulk, and so on. ARM has made great changes to the overall architecture of Azure. Many of the limitations in ASM have been removed. Is the main difference between the two modes:
This year, Azure will fully support the ARM model in China. It is important to note that the version of PowerShell that needs to be adopted on China Azure is 1.2.2. The latest version of 1.3.2 and 1.4.0 have some services that cannot be created. The specific is:
Https://github.com/Azure/azure-powershell/releases/download/v1.2.2-March2016/azure-powershell.1.2.2.msi
This article describes some simple ways to create and manage azure resources that are based on ARM mode.
1. Create Resource Group
To add an arm account first:
Add-azurermaccount-environmentname Azurechinacloud
Select this account:
Select-azuresubscription-subscriptionname "xxxx"-account [email protected]
Create Resouce Group
" China East " /SUBSCRIPTIONS/42E8B20D-29EC-40A5-B020-B2229F3DDA56/RESOURCEGROUPS/HWARM01
2. Create network-related content
2.1 Creating a Vnet
$subnet 1 = new-azurermvirtualnetworksubnetconfig-name Subnet-1-addressprefix 172.17.1.0/24$subnet 2 = new-azurermvirtualnetworksubnetconfig-name Subnet-2-addressprefix 172.17.2.0/24$subnet 3 = New-azurermvirtualnetworksubnetconfig-name Subnet-3-addressprefix 172.17.3.0/24$vnet"China East"$subnet 1,$subnet 2,$subnet 3
2.2 Creating a reserved IP
$PIPLB " China East " -allocationmethod Static
2.3 Creating Haset
$has " China East "
2.4 Creating a Load Balancer
$fendip= New-azurermloadbalancerfrontendipconfig-name Fendip-publicipaddressid$PIPLB. Id$bendip= New-azurermloadbalancerbackendaddresspoolconfig-Name Bendip$inboundNATRule 1= New-azurermloadbalancerinboundnatruleconfig-name Ssh1-frontendipconfigurationid$fendip. Id-protocol Tcp-frontendport 22122-backendport 22$inboundNATRule 2= New-azurermloadbalancerinboundnatruleconfig-name Ssh2-frontendipconfigurationid$fendip. Id-protocol Tcp-frontendport 22222-backendport 22$lbprobe= New-azurermloadbalancerprobeconfig-name Hwlbprobe-protocol tcp-port 80-intervalinseconds 15-probecount 2$lbrule= New-azurermloadbalancerruleconfig-name Hwlbrule-frontendipconfigurationid$fendip. Id-backendaddresspoolid$bendip. Id-probeid$lbprobe. Id-protocol Tcp-frontendport 80-backendport 80-loaddistribution SourceIP$lb= New-azurermloadbalancer-name Hwlb-resourcegroupname hwarm01-location"China East"-frontendipconfiguration$fendip-backendaddresspool$bendip-probe$lbprobe-inboundnatrule$inboundNATRule 1-loadbalancingrule$lbrule
2.5 Creating a network card
$nic 1= New-azurermnetworkinterface-name Nic1-resourcegroupname hwarm01-location"China East"-privateipaddress 172.17.1.4-subnetid$vnet. Subnets[0]. Id-loadbalancerbackendaddresspoolid$lb. Backendaddresspools[0].id-loadbalancerinboundnatruleid$lb. Inboundnatrules[0]. Id$nic 2= New-azurermnetworkinterface-name Nic2-resourcegroupname hwarm01-location"China East"-privateipaddress 172.17.1.5-subnetid$vnet. Subnets[0]. Id-loadbalancerbackendaddresspoolid$lb. Backendaddresspools[0].id-loadbalancerinboundnatruleid$lb. INBOUNDNATRULES[1]. Id
3. Create a storage-related
3.1. Create a Storage account
" China East "
3.2 Creating container
$sa = get-azurermstorageaccount-resourcegroupname hwarm01-Name hwarmsa01$sa | New-azurestoragecontainer-permission Off VHDs
3.3 Defining the URI of Osdisk, Datadisk
$OSdiskName = " hwarmvm01-osdisk.vhd $OSDiskURI = $sa . PrimaryEndpoints.Blob.AbsoluteUri + vhds/ + $OSdiskName $dataDiskName = $dataDiskURI = $sa . PrimaryEndpoints.Blob.AbsoluteUri + vhds/ + $dataDiskName
4. Defining the properties of a VM
4.1 Defining VM Basic Properties
$vmname " hwarmvm01 " $vmsize " STANDARD_A1 " $cred = get-credential-username Hengwei-Message hwarmvm01$vm$vmname$ Vmsize$has. Id
4.2 Defining information for Vmimage
" China East " -publishername openlogic-offer centos-skus 6.5Version filterexpression Skus offer publishername location Id-------------------------------------------------------6.5.20150904 6.5 CentOS openlogic Chinaeast/subscrip tions/42e8b20d-29ec-40a5-b020-B22 ... 6.5.20160329 6.5 CentOS openlogic chinaeast/subscriptions/42e8b20d-29ec-40a5-b020-b22 ... $vmimage " China East " -publishername openlogic-offer Centos-skus 6.5-version 6.5.20160329
4.3 Defining VM Operating System Information
$VM $VM $cred $vmname
4.4 Defining VM Disk Information
$VM $VM $vmimage $vmimage $vmimage $vmimage . Version$vm$vm$OSdiskName$OSDiskURI -createoption fromimage $VM $VM $dataDiskName $dataDiskURI -createoption EMPTY-DISKSIZEINGB 100
4.5 Defining VM NIC Information
$VM $VM $nic 1. Id
5. Create a virtual machine
" China East " $VM
Create an ARM virtual machine in China Azure with PowerShell