Win*_*oss 6 json azure dsc azure-resource-manager
我希望能够部署一个复杂的ARM模板,该模板利用我的本地Visual Studio中的DSC扩展和嵌套模板.该示例设置为从GitHub下载资产:https: //github.com/Azure/azure-quickstart-templates/tree/master/active-directory-new-domain-ha-2-dc 我需要做哪些更改我可以将资产绑定到我的本地Visual Studio项目并使用它们而不是从GitHub下载它们?以下是负责下载的模板的精简版:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
...
"adPDCVMName": {
"type": "string",
"metadata": {
"description": "The computer name of the PDC"
},
"defaultValue": "adPDC"
},
"assetLocation": {
"type": "string",
"metadata": {
"description": "The location of resources such as templates and DSC modules that the script is dependent"
},
"defaultValue": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/active-directory-new-domain-ha-2-dc"
}
...
},
"variables": {
...
"adPDCModulesURL": "[concat(parameters('assetLocation'),'/DSC/CreateADPDC.ps1.zip')]",
"adPDCConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC",
...
},
"resources": [
...
{
"name": "[parameters('adPDCVMName')]",
"type": "Microsoft.Compute/virtualMachines",
...
"resources": [
{
"name": "[concat(parameters('adPDCVMName'),'/CreateADForest')]",
"type": "Microsoft.Compute/virtualMachines/extensions",
...
"properties": {
...
"settings": {
"ModulesUrl": "[variables('adPDCModulesURL')]",
"ConfigurationFunction": "[variables('adPDCConfigurationFunction')]",
...
}
}
}
}
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
在Visual Studio中的"Azure资源组"项目中执行以下操作:
可以使用上传到存储帐户的文件.在这种情况下,您指的模板不使用通用命名约定.所以你需要稍微改变一下:
更改azuredeploy.json:将参数assetLocation的名称更改为_artifactsLocation.
第二步:添加参数_artifactsLocationSasToken作为securestring.这两个参数将由Visual Studio中的powershell脚本自动填充.
azuredeploy.json的一部分:
"parameters": {
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
}
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The SAS token to access the storage account"
}
},
Run Code Online (Sandbox Code Playgroud)
一个样本:
"vnetTemplateUri": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/vnet.json', parameters('_artifactsLocationSasToken'))]",
Run Code Online (Sandbox Code Playgroud)
更改完所有变量后.您可以使用项目中的资源而不是github从Visual Studio部署模板.
| 归档时间: |
|
| 查看次数: |
264 次 |
| 最近记录: |