Skip to content

Commit d61edef

Browse files
authored
Merge pull request #79231 from cynthn/patch-267
Update virtual-machines-windows-powershell-sample-create-nlb-vm.md
2 parents c42dd69 + 168d913 commit d61edef

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

articles/virtual-machines/scripts/virtual-machines-windows-powershell-sample-create-nlb-vm.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ This script uses the following commands to create the deployment. Each item in t
6565
| [New-AzVM](https://docs.microsoft.com/powershell/module/az.compute/new-azvm) | Create a virtual machine. |
6666
|[Remove-AzResourceGroup](https://docs.microsoft.com/powershell/module/az.resources/remove-azresourcegroup) | Removes a resource group and all resources contained within. |
6767

68+
You can also create the VMs using your own custom managed image. In the VM configuration, for `Set-AzVMSourceImage` use the `-Id` and `-VM` parameters instead of `-PublisherName`, `-Offer`, `-Skus`, and `-Version`.
69+
70+
For example, creating the VM config would be:
71+
72+
```powershell
73+
$vmConfig = New-AzVMConfig -VMName 'myVM3' -VMSize Standard_DS1_v2 -AvailabilitySetId $as.Id | `
74+
Set-AzVMOperatingSystem -Windows -ComputerName 'myVM3' -Credential $cred | `
75+
Set-AzVMSourceImage -Id <Image.ID of the custom managed image> | Add-AzVMNetworkInterface -Id $nicVM3.Id
76+
```
77+
6878
## Next steps
6979

7080
For more information on the Azure PowerShell module, see [Azure PowerShell documentation](/powershell/azure/overview).

0 commit comments

Comments
 (0)