问题描述
从 Azure 中的资源,我可以导出模板。
我看到了那些文件:
- https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resources-cli
- https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resources-powershell
但没有人解释如何运行导出模板。
如何运行此模板以重新创建包含所有资源的整个资源组? 另外,我想添加一个与作业相关的参数。例如,每个资源的名称中都必须包含此职位编号。
解决方法
您可以使用 powershell、CLI、Azure 门户(通过 REST API)、REST API 等部署 ARM 模板。您可以在 MS 文档上查看 How to deploy templates 系列 ARM 模板。很详细。
例如:带有模板+参数的powershell部署选项
New-AzResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup `
-TemplateFile <path-to-template> `
-TemplateParameterFile <path-to-parameters>