【问题标题】:Unable to spin up AD Forest by ARM Template无法通过 ARM 模板启动 AD 森林
【发布时间】:2019-08-07 07:24:25
【问题描述】:

我正在尝试通过 ARM 模板创建 Windows VM、AD 森林、域和 DC。

我正在使用这里的模板:

https://github.com/Azure/azure-quickstart-templates/tree/master/active-directory-new-domain

我创建了资源组,然后通过以下命令进行部署:

az group create --name arm-template --location "australiaeast"
az group deployment create -g arm-template --template-file=azuredeploy.json --parameters=azuredeploy.parameters.json

很遗憾,我收到以下错误:

400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxx/resourcegroups/arm-template/providers/Microsoft.Resources/deployments/azuredeploy?api-version=2018-05-01

我可以通过使用完全相同的参数转到 Azure 门户手动创建它们!想知道是什么问题以及如何解决它。

P。 S:编辑,使用模板文件不起作用。证据如下:

PS E:\OnlyOnMyPC\azure-quickstart-templates\active-directory-new-domain> New-AzResourceGroupDeployment -ResourceGroupName arm-template
 -TemplateFile azuredeploy.json -TemplateParameterFile .\azuredeploy.parameters.json
New-AzResourceGroupDeployment : 5:27:27 PM - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The
template resource '_artifactsLocation' at line '37' and column '31' is not valid: The language expression property 'templateLink'
doesn't exist, available properties are 'template, templateHash, parameters, mode, provisioningState'.. Please see
https://aka.ms/arm-template-expressions for usage details.'.
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName arm-template -Templa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzResourceGroupDeployment : The deployment validation failed
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName arm-template -Templa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzResourceGroupDeployment], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

【问题讨论】:

  • 用 cloudshell 试试同样的方法,我怀疑你的 azcli 有问题
  • 尝试使用 cloudshell 相同的错误。尝试使用 --verbose 但它没有提供任何价值。
  • 试试powershell?
  • 是的,尝试使用 PowerShell 并意识到它需要 Template-url 所以本地文件不会这样做
  • 废话,你可以使用本地文件

标签: azure active-directory arm-template


【解决方案1】:

我的工作方式是通过以下命令:

az group deployment create -g arm-template --template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/active-directory-new-domain/azuredeploy.json" --parameters @azuredeploy.parameters.json

原因是 azuredeploy.json 使用 templateLink.uri。不幸的是,您必须使用存储帐户上传文件并在模板中引用它。

更多阅读here

现在,了解让我意识到我使用 Azure PowerShell 而不是 Azure Cli 的原因也很重要,它报告的错误消息比 HTTP 400 更好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多