Error when creating azure management group using Azure managed application using custom ui

728 Views Asked by At

I am trying to create a management group using Azure Service Catalog managed application, but facing an error. But on other hand, same template gets deployed using custom template deployment.

Following is the mainTemplate.json - used to create a management group

{
    "$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": {
    }
}

Following is the custom UI to fetch prefix for the management group 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]"
    }
  }
}

Facing below error when trying to create a management group using Service Catalog

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}"
                }
            ]
        }
    }
1

There are 1 best solutions below

0
On

Service catalog only support resource group level deployments, where Management Groups require the tenant level deployment scope. Instead, I would recommend using Template Specs to manage a template made for creating management groups for your organization.