简体   繁体   中英

Create a Azure VM with unmanaged data disks enabled using powershell

I am trying to create a azure vm using powershell so that it would allow to attach unmanaged data disks in future. I see documentation on creating but those always create with managed disks

Example .

nic\network\etc amended

# Create storage account
$storageAccount = New-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -Location $location -SkuName "Standard_LRS"

# Add disk
$OSDiskUri = $storageAccount.PrimaryEndpoints.Blob.ToString() + "vhds/vm-disk.vhd"
$vm = Set-AzVMOSDisk -VM $vm -Name "vm-disk" -VhdUri $OSDiskUri -CreateOption fromImage 

# Create VM
New-AzVM -ResourceGroupName myResourceGroup -Location $location -VM $vm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM