如何从 ARM 模板部署初始化/格式化 Azure Windows VM 的数据磁盘? [英] How to initialize/format Azure Windows VM's Data Disks from ARM Template Deployment?

查看:31
本文介绍了如何从 ARM 模板部署初始化/格式化 Azure Windows VM 的数据磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 ARM 模板部署 Azure Windows VM.

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?

当您从 Azure 门户进行部署时,它是如何做到的?

How does the Azure Portal do it when you deploy from it?

推荐答案

使用 自定义脚本扩展,这些都可以在Powershell中完成,例如

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

这篇关于如何从 ARM 模板部署初始化/格式化 Azure Windows VM 的数据磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆