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

查看:84
本文介绍了如何通过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门户进行部署时,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天全站免登陆