Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Azure powershell uses platform mirroring to create ARM unmanaged disk virtual machines

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Select-AzureRmSubscription-SubscriptionName "xxxxxxxx" # Select subscription environment

# Network options

$myVirtualNetworkResourceGroup = "xxxxxxxx" # Virtual network resource group

$myVirtualNetworkName = "xxxxxxxx" # Virtual network

$myVirtualNetworkSubnetName = "xxxxxxxx" # Virtual subnet

$myResourceGroupName = "xxxxxxxx"

$myLocation = "xxxxxxxx"

$myAvailabilitySetName = "xxxxxxxx"

$myNetworkInterfaceName = "xxxxxxxx"

$myPublicIpAddressName = "xxxxxxxx"

$myDomainName = "xxxxxxxx"

$myLoadBalancerFrontendName = "xxxxxxxx" # name of the load balancer front end

$myLoadBalancerBackendName = "xxxxxxxx" # load balancer backend name

$myLoadBalanceName = "xxxxxxxx"

$myStorageAccountName = "xxxxxxxx"

# $myOSDiskUri = "http://" + $myStorageAccountName +" .blob.core.chinacloudapi.cn / vhds/ "+" myOSDisk.vhd "

$myVMName = "xxxxxxxx"

$myVMSize = "Standard_D3_V2"

$myUsername = "leo" # Custom user name

$myPassword = "xxxxxxxx" # Virtual machine account password

# create a resource group

$myResourceGroup = New-AzureRmResourceGroup-Name $myResourceGroupName-Location $myLocation

# create an availability set

$myAvailabilitySet = New-AzureRmAvailabilitySet-Location $myLocation-Name $myAvailabilitySetName-ResourceGroupName $myResourceGroupName

# create a storage account

$myStorageAccount = New-AzureRMStorageAccount-Location $myLocation-Name $myStorageAccountName-ResourceGroupName $myResourceGroupName-SkuName Standard_LRS

# create a public IP address

$myPublicIpAddressName = New-AzureRmPublicIpAddress-ResourceGroupName $myResourceGroupName-AllocationMethod Dynamic-Name $myPublicIpAddressName-Location $myLocation-DomainNameLabel $myDomainName

# create a front-end pool

$myLoadBalancerFrontend = New-AzureRmLoadBalancerFrontendIpConfig-Name $myLoadBalancerFrontendName-PublicIpAddress $myPublicIpAddressName

# create backend pool

$myLoadBalancerBackend = New-AzureRmLoadBalancerBackendAddressPoolConfig-Name $myLoadBalancerBackendName

# create a load balancer set

$myLoadBalancer = New-AzureRmLoadBalancer-Location $myLocation-Name $myLoadBalanceName-ResourceGroupName $myResourceGroupName-FrontendIpConfiguration $myLoadBalancerFrontend-BackendAddressPool $myLoadBalancerBackend

# create a network interface

$myVirtualNetwork = Get-AzureRmVirtualNetwork-ResourceGroupName $myVirtualNetworkResourceGroup-Name $myVirtualNetworkName

$myVirtualNetworkSubnet = Get-AzureRmVirtualNetworkSubnetConfig-VirtualNetwork $myVirtualNetwork-Name $myVirtualNetworkSubnetName

$myNetworkInterface = New-AzureRmNetworkInterface-Name $myNetworkInterfaceName-ResourceGroupName $myResourceGroupName-Location $myLocation-Subnet $myVirtualNetworkSubnet-LoadBalancerBackendAddressPool $myLoadBalancerBackend

# create login credentials

MyCred = New-Object System.Management.Automation.PSCredential ($myUsername, (ConvertTo-SecureString $myPassword-AsPlainText-Force))

# system disk path

$myURL = "http://" + $myStorageAccountName +" .blob.core.chinacloudapi.cn / vhds/ "+ $myVMName +" myOSDisk.vhd "

# Virtual Machine configuration

$vmConfig = New-AzureRmVMConfig-VMName $myVMName-VMSize $myVMSize-AvailabilitySetId $myAvailabilitySet.Id | `

Set-AzureRmVMOperatingSystem-Windows-ComputerName $myVMName-Credential $myCred | `

Set-AzureRmVMSourceImage-PublisherName MicrosoftWindowsServer-Offer WindowsServer-Skus 2016-Datacenter-zhcn-Version latest | `

Add-AzureRmVMNetworkInterface-Id $myNetworkInterface.Id | `

Set-AzureRmVMOSDisk-CreateOption FromImage-VhdUri $myURL-Windows

# create a virtual machine

$myVM = New-AzureRmVM-ResourceGroupName $myResourceGroupName-Location $myLocation-VM $vmConfig

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report