12. After the template file is ready, we use PowerShell to create an auto-expanding collection of VMSS for Linux and first login to the ARM account in Azure China:
Login-azurermaccount-environmentname Azurechinacloud
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909120957816-1592234599. PNG "style=" border:0px; "/>
13. If you have multiple subscriptions, select the correct subscription you want to create VMSS:
Select-azurermsubscription-subscriptionid xxxxxxxxxx
14. If you have not created a resource group before, create one, and the resources for all auto-expansion sets are placed under this resource group:
New-azurermresourcegroup-name linuxvmssgroup-location "China North"
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909120958207-1007285402. PNG "style=" border:0px; "/>
15. Go to the directory where you placed the template, and use the arm template and parameter files you created to create an auto-expanding collection of Linux:
New-azurermresourcegroupdeployment-name vmssautoscaledeployment-resourcegroupname linuxvmssgroup-templatefile. \ Vmsslinuxsample.json-templateparameterfile. \vmsslinuxsample-parameters.json
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909120958754-534285781. PNG "style=" border:0px; "/>
You can see that VMSS has been successfully created, the OS used is Ubuntu 14.04.3, and the virtual machine size is standard A1
16. Go to the new management portal,https://portal.azure.cn, select the resource group, find the Linuxvmssgroup resource group you created, you can see that the auto-expansion set has been created successfully, contains auto-expansion set, load Balancer, public IP address, and 5 storage accounts for virtual machines
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909120959223-2131634278. PNG "style=" border:0px; "/>
By opening the virtual machine extension collection Mylinuxau, you can see that there are two virtual machines in this collection, and Autoscale (auto scaling) is on and automatically scaled according to the rules:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909120959785-110730446. PNG "style=" border:0px; "/>
How do I manage an auto-expansion set?
At the beginning, we mentioned that VMSS provides automatic extension of PAAs, management flexibility of IaaS, so how can I manage the collections in my collection after we have created an auto-expansion set?
1.SSH Login
For Linux virtual machines, we want to be able to directly login to the inside of the virtual machine, to operate, then in the VMSs we created, how to do? We actually used lb, we did NAT on inbound rules, landed on the portal, selected the load balancer under the resource group, and chose the inbound Nat rule, and we would see that our two instances are mapped ports are tcp/50000,tcp/50002:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909121000285-1174628383. PNG "style=" border:0px; "/>
By clicking on our first instance, we can see that the 22 port of the virtual machine is actually the target port and the external mapping is 50000, then we can use IP address + port 50000 to log on to the virtual machine for management:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909121000738-1324092670. PNG "style=" border:0px; "/>
Open Putty, enter the IP address 139.217.13.118. Port 50000, you can normally log on to Linux, do a variety of operations:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909121001129-2076878931. PNG "style=" border:0px; "/>
2. Use PowerShell to manage VMSS: Of course we can use PS to get VMSS related information, stop or start the current VM:
Get more information on VMSS
Get-azurermvmss-resourcegroupname Linuxvmssgroup-vmscalesetname Mylinuxau
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909121001816-825543859. PNG "style=" border:0px; "/>
Get more information about the instance in VMSs:
Get-azurermvmssvm-resourcegroupname linuxvmssgroup-vmscalesetname Mylinuxau-instanceid 0-instanceview
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/845013/201609/845013-20160909121002332-306107234. PNG "style=" border:0px; "/>
To close a virtual machine in the current VMSS:
Stop-azurermvmss-resourcegroupname linuxvmssgroup-vmscalesetname Mylinuxau-instanceid 1
To start a virtual machine in the current VMSS:
Start-azurermvmss-resourcegroupname linuxvmssgroup-vmscalesetname Mylinuxau-instanceid 0
In the following chapters, I will introduce you to the fundamentals of VMSS, best practices, and how to test and debug VMSs, so please expect:)
Deploying auto-extended Linux VMSS using arm templates (2)