Reputation: 179
I'm trying to deploy Azure Windows VMs using ARM Templates.
Although I've managed to add Data Disks to the Template, I then have to initialize them at the OS level from Disk Management.
Is there a way to initialize and format them automatically, while making the deployment?
How does the Azure Portal do it when you deploy from it?
Upvotes: 1
Views: 1691
Reputation: 89371
Use a custom script extension, and this can all be done in Powershell, eg
PS C:\>Get-Disk | Where-Object OperationalStatus -eq 'Offline'|
Initialize-Disk -PartitionStyle GPT -PassThru |
New-Volume -FileSystem NTFS -DriveLetter F -FriendlyName 'New-Volume'
https://learn.microsoft.com/en-us/powershell/module/storage/new-volume?view=win10-ps
Upvotes: 3