使用自定义 ui 使用 Azure 托管应用程序创建 azure 管理组时出错

问题描述

我正在尝试使用 Azure 服务目录托管应用程序创建管理组,但遇到错误。但另一方面,使用自定义模板部署来部署相同的模板。

以下是 ma​​inTemplate.json - 用于创建管理组

{
    "$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
        "enterpriseScaleCompanyPrefix": {
            "type": "string","Metadata": {
                "description": "Provide prefix for the management group structure."
            }
        }
    },"variables": {
    },"resources": [
        {
            // Create top level management group under tenant root
            "type": "Microsoft.Management/managementGroups","apiVersion": "2020-05-01","name": "[parameters('enterpriseScaleCompanyPrefix')]","properties": {}
        }
    ],"outputs": {
    }
}

以下是为管理组获取前缀的自定义 UI createUi.json

{
  "handler": "Microsoft.Azure.CreateUIDef","version": "0.1.2-preview","parameters": {
    "basics": [
      {}
    ],"steps": [
      {
        "name": "lzSettings","label": "Company prefix","subLabel": {
          "preValidation": "Provide a company prefix for the management group structure that will be created.","postValidation": "Done"
        },"bladeTitle": "Company prefix","elements": [
          {
            "name": "infoMgmtGroup","type": "Microsoft.Common.InfoBox","visible": true,"options": {
              "icon": "Info","text": "Landing Zone template will create the management group hierarchy under the Tenant Root Group with the prefix provided at this step."
            }
          },{
            "name": "esMgmtGroup","type": "Microsoft.Common.TextBox","label": "Management Group prefix","toolTip": "Provide a prefix (max 15 characters,unique at tenant-scope) for the Management Group hierarchy and other resources created as part of the landing zone.","defaultValue": "","constraints": {
              "required": true,"regex": "^[a-z0-9A-Z-]{1,15}$","validationMessage": "The prefix must be 1-15 characters."
            }
          }
        ]
      }
    ],"outputs": {
      "enterpriseScaleCompanyPrefix": "[steps('lzSettings').esMgmtGroup]"
    }
  }
}

尝试使用服务目录创建管理组时遇到错误

Managed Application DeFinition - 

    {
        "status": "Failed","error": {
            "code": "ApplianceDeploymentFailed","message": "The operation to create appliance Failed. Please check operations of deployment 'abcc' under resource group '/subscriptions/8c1c88a7-63eb-491d-9c48-af253d446b59/resourceGroups/mrg-abc09-20210706122807'. Error message: 'At least one resource deployment operation Failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.'","details": [
                {
                    "code": "NotFound","message": "{\r\n  \"error\": {\r\n    \"code\": \"BadRequest\",\r\n    \"message\": \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\\">\\r\\n<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n<head>\\r\\n<Meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=iso-8859-1\\\"/>\\r\\n<title>404 - File or directory not found.</title>\\r\\n<style type=\\\"text/css\\\">\\r\\n<!--\\r\\nbody{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#EEEEEE;}\\r\\nfieldset{padding:0 15px 10px 15px;} \\r\\nh1{font-size:2.4em;margin:0;color:#FFF;}\\r\\nh2{font-size:1.7em;margin:0;color:#CC0000;} \\r\\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \\r\\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\\\"trebuchet MS\\\",Verdana,sans-serif;color:#FFF;\\r\\nbackground-color:#555555;}\\r\\n#content{margin:0 0 0 2%;position:relative;}\\r\\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\\r\\n-->\\r\\n</style>\\r\\n</head>\\r\\n<body>\\r\\n<div id=\\\"header\\\"><h1>Server Error</h1></div>\\r\\n<div id=\\\"content\\\">\\r\\n <div class=\\\"content-container\\\"><fieldset>\\r\\n  <h2>404 - File or directory not found.</h2>\\r\\n  <h3>The resource you are looking for might have been removed,had its name changed,or is temporarily unavailable.</h3>\\r\\n </fieldset></div>\\r\\n</div>\\r\\n</body>\\r\\n</html>\\r\\n\"\r\n  }\r\n}"
                }
            ]
        }
    }

解决方法

服务目录仅支持资源组级别的部署,其中管理组需要租户级别的部署范围。相反,我建议使用 Template Specs 来管理为您的组织创建管理组而制作的模板。