0
votes

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?

1
Hi Can you give me the ARM template file for add Data Disks to the Virtual machine.Dnyaneshwar Suryawanshi

1 Answers

1
votes

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://docs.microsoft.com/en-us/powershell/module/storage/new-volume?view=win10-ps