要使用 PowerShell 命令创建新的 Azure 虚拟机 (VM),可将本地安装的 Windows PowerShell 与 Az 模块配合使用,也可以使用 Azure 门户中提供的 Cloud Shell 环境。 如果选择使用本地安装的 PowerShell,建议使用 Windows PowerShell 7.1。 还应安装 Az 模块,以获得与 Azure
"azure_tags": {"dept":"Engineering","task":"Image deployment"},"build_resource_group_name":"myPackerGroup","vm_size":"Standard_D2_v2"}],"provisioners": [{"type":"powershell","inline": ["Add-WindowsFeature Web-Server","while ((Get-Service RdAgent).Status -ne 'Running') { ...
PowerShell Copy $vmName = $vmNamePrefix + $suffixNumber $vmConfig = New-AzureVMConfig -Name $vmName ` -ImageName $image ` -InstanceSize $vmSize ` -AvailabilitySetName $avSetName Provision the VM as a Windows VM. PowerShell Copy Add-AzureProvisioningConfig -VM $vmCon...
The assignment is scoped to the specified Azure subscription. It adds the service principal to the Reader role. If an error occurs during the role assignment, it retries the assignment. PowerShell Copy Param ( [Parameter(Mandatory=$true)] [String] $ApplicationDisplayName, [Parameter(Mandatory=...
Hi Azure friends, I used the PowerShell ISE for this configuration. But you are also very welcome to use Visual Studio Code, just as you...
Use PowerShell to Create Virtual Machine in Azure – Part 4 Your first challenge is to create a custom virtual machine, which really isn’t a challenge. Let’s imagine you’ve got a machine that’s set up just the way you want it. Life is good and you’re ready to rock. The firs...
The other part that makes all of this far easier in Azure Resource Manager is knowing that you can create a VM (like we did last week) within the portal and then access its properties to knowwhatto supply to PowerShell. As you know, often it’s not about what parameters I...
In this chapter, we learned how to create a virtual machine using PowerShell. First, you need to verify the subscription information, use an existing StorageAccount or create a StorageAccount and set Azure Subscriptions. You have to create an Azure Service. ...
Install the Azure Virtual Desktop Agent: On each VM, install the Azure Virtual Desktop Agent and register the VM using the registration token. This can be done via a script executed on the VM: Invoke-WebRequest -Uri "https://aka.ms/...
Get-AzureVM -ServiceName $VmName -Name $VmName -Verbose | Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel "main" -LUN 1 -Verbose | Update-AzureVM -Verbose } Conclusion Reference http://sqlblog.com/blogs/marco_russo/archive/2013/10/29/powershell-script-to-deploy-multiple-vm-on...