Here is how you can select the operating system using PS script
$Publisher = Get-AzVMImagePublisher -Location 'East US' | Where-Object PublisherName -eq "MicrosoftWindowsServer"
$Offer = $Publisher | Get-AzVMImageOffer | Where-Object Offer -eq "WindowsServer"
$Sku = $Offer | Get-AzVMImageSku | Where-Object Skus -eq "2019-Datacenter"
$VMImage = $Sku | Get-AzVMImage | Select-Object -Last 1
# $VMImage now has following properties variables
# - publisher
# - offer
# - sku
# - image
how to create a VM with public ip address with"new-azvm -vm $vm"
![](https://techprofile.blob.core.windows.net/images/avr9p6FeDECVZOR5aOyWhw.png?8D9B61)
Yuxiang
21
Reputation points
how to create a VM with public ip address with"new-azvm -vm $vm"
I know "New-AzVm -PublicIpAddressName" can create it,but it can't select operatingsystem image(-PublisherName $pubName -Offer $offerName -Skus $skuName...)
Is it possible to create a configurable VM with publicipaddress via "new-azvm-vm $vm"
Accepted answer
-
Manu Philip 17,671 Reputation points MVP
2021-12-02T09:40:21.8+00:00