Azure PowerShell Create a virtual machine

Source: Internet
Author: User

# Login Resources

# login-azurermaccount-environmentname "Azurechinacloud"

# select-azurermsubscription-subscriptionname "Subscription name"

?

# add-azureaccount-environment Azurechinacloud

# select-azuresubscription-subscriptionname "Subscription name"

?

# Get Subscriptions

# Get-azuresubscription | where {$_. Subscriptionname-eq "subscription Name"} | Select Subscriptionname, Iscurrent | Format-table-autosize

# Get Storage Account

# Get-azurestorageaccount | where {$_. Storageaccountname-eq "Storage Account"} | Select Storageaccountname, Storageaccountstatus, statusofprimary| Format-table-autosize

# Get the Mirror name

# Get-azurevmimage | where {$_. Imagename-like "*centos-72*"} | SELECT ImageName | Format-table-autosize

# 55BC2B193643443BB879A78BDA516FC8__WINDOWS-SERVER-2012-R2-20160721-ZH.CN-127GB.VHD

# f1179221e23b4dbb89e39d70e5bc9e72__openlogic-centos-72-20160617

# Get-azurevmimage | where {$_. Imagename-like "*windows-server-2012-r2*"-and $_. Imagename-like "*zh.cn*"} | SELECT ImageName | Format-table-autosize

# Get Network Settings

# get-azurevnetsite-vnetname "virtual Network Name" | Select Subnets | Format-table-autosize

# Get Cloud Services

# get-azureservice-servicename "cloud Service Name" | Select Location, Status | Format-table-autosize

?

# Specify Subscription Name

$subscriptionName = "Subscription Name"

# Specify the storage used to save the virtual machine VHD

$storageAccount = "Storage Account"

# Set the current subscription's storage account

Select-azuresubscription-subscriptionname $subscriptionName Set-azuresubscription-subscriptionname $ Subscriptionname-currentstorageaccountname $storageAccount

# Specify virtual machine name

$name = "Virtual machine name"

# Specify virtual machine size

$instanceSize = "Large"

# Specify a validation set

$availabilitysetName = "Effectivity Set name"

# Specify the image name

$imageName = "55bc2b193643443bb879a78bda516fc8__windows-server-2012-r2-20160721-zh.cn-127gb.vhd"

# Specify administrator name

$adminssername = "User name"

# Specify password

$password = "Password"

# Specify the time zone $timeZone =

# Specify a virtual network

$subnetNames = "Subnet Name"

# Specify Cloud service Name

$serviceName = "Cloud service Name"

# Specify the Network name

$vnetName = "Virtual Network Name"

?

New-azurevmconfig-name $name-instancesize $instanceSize-availabilitysetname $availabilitysetName-imagename $ ImageName | Add-azureprovisioningconfig-windows-adminusername $adminssername-password $password-disableautomaticupdates- TimeZone $timeZone | Set-azuresubnet-subnetnames $subnetNames | New-azurevm-servicename $serviceName-vnetname $vnetName

Azure PowerShell Create a virtual machine

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.