Azure VMSS----PowerShell Create a custom mirrored VMSS cluster

Source: Internet
Author: User

The previous article describes how to create a standard mirrored VMSS cluster with PowerShell. Http://www.cnblogs.com/hengwei/p/7391178.html

This article describes how to create a custom mirrored VMSS cluster with PowerShell.

1 Create VMS, personalize them, such as install httpd, add date disk, etc., and capture this VM as an image

2 Create a VMSS cluster with this image

Create and capture an image

This operation is also described in the previous article:

Http://www.cnblogs.com/hengwei/p/7348453.html

Implemented with the Azure CLI tools.

The customized work includes:

1 Installed the httpd

2 configured Fstab auto mount/DEV/SDC1 to/var/www/html

3 Creating a index.html file in/var/www/html

4 shutting down firewalls and SELinux

The principle is the same, there is not much to introduce. Just introduce the relevant commands for PowerShell to capture the image:

Set-azurermvm-resourcegroupname hwvmssp-name hwimage-generalized-Verbose$vm$VM = Get-azurermvm-resourcegroupname HWVMSSP-Name hwimage$image$vm. Idnew$image

or capture directly on the Portal:

II Create a custom mirrored VMSS cluster

In the previous article, we created the corresponding vnet, SLB, and we also used the original network resources. To create a specific method, you can refer to:

Http://www.cnblogs.com/hengwei

The specific script is as follows:

$loc=' Chinanorth ';$rgname=' HWVMSSP ';$vnet= Get-azurermvirtualnetwork-name$rgname-resourcegroupname$rgname;$subnetName=' Vlan1 '$subnetId=$vnet. Subnets[0]. Id;$pubip= Get-azurermpublicipaddress-name (' Pubip ' +$rgname)-resourcegroupname$rgname;$lbName= ' VMSSLB ' +$rgname$actualLb= Get-azurermloadbalancer-name$lbName-resourcegroupname$rgname$vmssName=$rgname;$adminUsername=' Hengwei ';$adminPassword="xxxx";$vmNamePrefix=' Centosvmss '$IPCFG= New-azurermvmssipconfig-Name ' Nic '-loadbalancerinboundnatpoolsid$actualLb. Inboundnatpools[0]. Id '-loadbalancerbackendaddresspoolsid$actualLb. Backendaddresspools[0]. Id '-subnetid$subnetId;$numberofnodes= 2$image= Get-azurermimage-resourcegroupname HWVMSSP-ImageName vmssimage$vmss= New-azurermvmssconfig-location$loc-skucapacity$numberofnodes`
-skuname ' Standard_d1 '-upgradepolicymode ' Automatic '
  | Add-azurermvmssnetworkinterfaceconfiguration-name$subnetName`
-primary$true-ipconfiguration$IPCFG `
  | Set-azurermvmssosprofile-computernameprefix$vmNamePrefix`
-adminusername$adminUsername-adminpassword$adminPassword `
  | Set-azurermvmssstorageprofile-osdiskcreateoption ' FromImage '
-osdiskcaching ' None '-osdiskostype Linux
-manageddisk Standardlrs-imagereferenceid$image. Id New-azurermvmss-resourcegroupname$rgname-name$vmssName·
-virtualmachinescaleset$vmss

Once created, sign in to instance, and you can see that the client work done in the previous image is also in:

Web pages can also be opened:

Summarize:

Creating a VMSS with a custom image makes it very easy to customize.

Azure VMSS----PowerShell Create a custom mirrored VMSS cluster

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.