swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure Management Groups API enables consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies, alerting and reporting for those resources.
  title: Management Groups
  version: 2018-03-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/managementgroups/resource-manager/Microsoft.Management/preview/2018-03-01-preview/management.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: managementgroups-management
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow.
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  ApiVersionParameter:
    description: Version of the API to be used with the client request. The current version is 2018-01-01-preview.
    in: query
    name: api-version
    required: true
    type: string
  CacheControlHeader:
    default: no-cache
    description: Indicates that the request shouldn't utilize any caches.
    in: header
    name: Cache-Control
    type: string
    x-ms-parameter-location: method
  CheckNameAvailabilityParameter:
    description: Management group name availability check parameters.
    in: body
    name: checkNameAvailabilityRequest
    required: true
    schema:
      $ref: "#/definitions/CheckNameAvailabilityRequest"
    x-ms-parameter-location: method
  CreateManagementGroupRequestParameter:
    description: Management group creation parameters.
    in: body
    name: createManagementGroupRequest
    required: true
    schema:
      $ref: "#/definitions/CreateManagementGroupRequest"
    x-ms-parameter-location: method
  EntityFilterParameter:
    description: The filter parameter allows you to filter on the name or display name fields. You can check for equality on the name field (e.g. name eq '{entityName}')  and you can check for substrings on either the name or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case insensitively.
    in: query
    name: $filter
    required: false
    type: string
    x-ms-parameter-location: method
  EntityViewParameter:
    description: The view parameter allows clients to filter the type of data that is returned by the getEntities call.
    enum:
      - FullHierarchy
      - GroupsOnly
      - SubscriptionsOnly
      - Audit
    in: query
    name: $view
    required: false
    type: string
    x-ms-parameter-location: method
  ExpandParameter:
    description: The $expand=children query string parameter allows clients to request inclusion of children in the response payload.
    enum:
      - children
    in: query
    name: $expand
    required: false
    type: string
    x-ms-parameter-location: method
  FilterParameter:
    description: A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription')
    in: query
    name: $filter
    required: false
    type: string
    x-ms-parameter-location: method
  GroupIdParameter:
    description: Management Group ID.
    in: path
    name: groupId
    required: true
    type: string
    x-ms-parameter-location: method
  GroupNameParameter:
    description: A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name eq 'groupName'")
    in: query
    name: groupName
    required: false
    type: string
    x-ms-parameter-location: method
  OperationResultIdParameter:
    description: The id of the operation result.
    enum:
      - create
      - delete
    in: path
    name: operationResultId
    required: true
    type: string
    x-ms-parameter-location: method
  PatchGroupRequestParameter:
    description: Management group patch parameters.
    in: body
    name: patchGroupRequest
    required: true
    schema:
      $ref: "#/definitions/PatchManagementGroupRequest"
    x-ms-parameter-location: method
  RecurseParameter:
    description: The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. Note that  $expand=children must be passed up if $recurse is set to true.
    in: query
    name: $recurse
    required: false
    type: boolean
    x-ms-parameter-location: method
  SearchParameter:
    description: The $search parameter is used in conjunction with the $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user's permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and  first level of children that the user has either direct access to or indirect access via one of their descendants.
    enum:
      - AllowedParents
      - AllowedChildren
      - ParentAndFirstLevelChildren
      - ParentOnly
      - ChildrenOnly
    in: query
    name: $search
    required: false
    type: string
    x-ms-parameter-location: method
  SelectParameter:
    description: This parameter specifies the fields to include in the response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter can override select in $skipToken.
    in: query
    name: $select
    required: false
    type: string
    x-ms-parameter-location: method
  SkipParameter:
    description: Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
    in: query
    name: $skip
    required: false
    type: integer
    x-ms-parameter-location: method
  SkipTokenParameter:
    description: Page continuation token is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls.
    in: query
    name: $skiptoken
    required: false
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: Subscription ID.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: method
  TopParameter:
    description: Number of elements to return when retrieving results. Passing this in will override $skipToken.
    in: query
    name: $top
    required: false
    type: integer
    x-ms-parameter-location: method
tags:
  - description: A Management Group is a customer defined scope (grouping mechanism) that provides access control (authorization), policy management and reporting. Management Groups are organized in a strictly tree-based hierarchy.
    name: ManagementGroups
  - description: Management operations supported by the Microsoft.Management resource provider.
    name: Operations
  - description: A list of entities that belong to the Management Groups.
    name: Entities
paths:
  /providers/Microsoft.Management/checkNameAvailability:
    post:
      description: Checks if the specified management group name is valid and unique
      operationId: CheckNameAvailability
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CheckNameAvailabilityParameter"
      responses:
        "200":
          description: OK. The request has succeeded.
          schema:
            $ref: "#/definitions/CheckNameAvailabilityResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - CheckNameAvailability
      x-ms-examples:
        CheckManagementGroupNameAvailability:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            checkNameAvailabilityRequest:
              name: nameTocheck
              type: /providers/Microsoft.Management/managementGroups
          responses:
            "200":
              body:
                message: <error message>
                nameAvailable: false
                reason: AlreadyExists
  /providers/Microsoft.Management/getEntities:
    post:
      description: List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
      operationId: Entities_List
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SkipTokenParameter"
        - $ref: "#/parameters/SkipParameter"
        - $ref: "#/parameters/TopParameter"
        - $ref: "#/parameters/SelectParameter"
        - $ref: "#/parameters/SearchParameter"
        - $ref: "#/parameters/EntityFilterParameter"
        - $ref: "#/parameters/EntityViewParameter"
        - $ref: "#/parameters/GroupNameParameter"
        - $ref: "#/parameters/CacheControlHeader"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/EntityListResult"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Entities
      x-ms-examples:
        GetEntities:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-01-01-preview
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000
                    name: 20000000-0001-0000-0000-000000000000
                    properties:
                      displayName: Group 1 Tenant 2
                      inheritedPermissions: view
                      numberOfChildGroups: 1
                      numberOfChildren: 2
                      numberOfDescendants: 3
                      parent:
                        id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                      parentDisplayNameChain:
                        - Tenant Root Group
                        - Group 1 Tenant 2 Parent
                      parentNameChain:
                        - TenantRootGroup
                        - Group1Tenant2Parent
                      permissions: view
                      tenantId: 20000000-0000-0000-0000-000000000000
                    type: /providers/Microsoft.Management/managementGroups
                  - id: /providers/Microsoft.Management/managementGroups/20000000-0004-0000-0000-000000000000
                    name: 20000000-0004-0000-0000-000000000000
                    properties:
                      displayName: Group 4 Tenant 2
                      inheritedPermissions: delete
                      numberOfChildGroups: 0
                      numberOfChildren: 0
                      numberOfDescendants: 0
                      parent:
                        id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                      parentDisplayNameChain:
                        - Tenant Root Group
                        - Group 4 Tenant 2 Parent
                      parentNameChain:
                        - TenantRootGroup
                        - Group4 Tenant2Parent
                      permissions: delete
                      tenantId: 20000000-0000-0000-0000-000000000000
                    type: /providers/Microsoft.Management/managementGroups
      x-ms-pageable:
        nextLinkName: nextLink
  /providers/Microsoft.Management/managementGroups:
    get:
      description: List management groups for the authenticated user.
      operationId: ManagementGroups_List
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
        - $ref: "#/parameters/SkipTokenParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ManagementGroupListResult"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        ListManagementGroups:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000
                    name: 20000000-0001-0000-0000-000000000000
                    properties:
                      displayName: Group 1 Tenant 2
                      tenantId: 20000000-0000-0000-0000-000000000000
                    type: /providers/Microsoft.Management/managementGroups
                  - id: /providers/Microsoft.Management/managementGroups/20000000-0004-0000-0000-000000000000
                    name: 20000000-0004-0000-0000-000000000000
                    properties:
                      displayName: Group 4 Tenant 2
                      tenantId: 20000000-0000-0000-0000-000000000000
                    type: /providers/Microsoft.Management/managementGroups
      x-ms-pageable:
        nextLinkName: nextLink
  "/providers/Microsoft.Management/managementGroups/{groupId}":
    delete:
      description: Delete management group. If a management group contains child resources, the request will fail.
      operationId: ManagementGroups_Delete
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
      responses:
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/OperationResults"
        "204":
          description: NoContent
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        DeleteManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: GroupToDelete
          responses:
            "202":
              body:
                id: /providers/Microsoft.Management/managementGroups/GroupToDelete
                name: GroupToDelete
                properties:
                  provisioningState: Updating
                type: /providers/Microsoft.Management/managementGroups
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Get the details of the management group.
      operationId: ManagementGroups_Get
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/ExpandParameter"
        - $ref: "#/parameters/RecurseParameter"
        - $ref: "#/parameters/FilterParameter"
        - $ref: "#/parameters/CacheControlHeader"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ManagementGroup"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        GetManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: 20000000-0001-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000
                name: 20000000-0001-0000-0000-000000000000
                properties:
                  details:
                    parent:
                      displayName: RootGroup
                      id: /providers/Microsoft.Management/managementGroups/RootGroup
                      name: RootGroup
                    updatedBy: 16b8ef21-5c9f-420c-bcc9-e4f8c9f30b4b
                    updatedTime: 2018-01-01T00:00:00.00Z
                    version: 1
                  displayName: Group 1 Tenant 2
                  tenantId: 20000000-0000-0000-0000-000000000000
                type: /providers/Microsoft.Management/managementGroups
        GetManagementGroupWithExpand:
          parameters:
            $expand: children
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: 20000000-0001-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000
                name: 20000000-0001-0000-0000-000000000000
                properties:
                  children:
                    - displayName: Group 2 Tenant 2
                      id: /providers/Microsoft.Management/managementGroups/20000000-0002-0000-0000-000000000000
                      name: 20000000-0002-0000-0000-000000000000
                      type: /providers/Microsoft.Management/managementGroups
                    - displayName: Group 3 Tenant 2
                      id: /providers/Microsoft.Management/managementGroups/20000000-0003-0000-0000-000000000000
                      name: 20000000-0003-0000-0000-000000000000
                      type: /providers/Microsoft.Management/managementGroups
                    - displayName: Subscription 4 Tenant 1
                      id: /subscriptions/10000000-F004-0000-0000-000000000000
                      name: 10000000-F004-0000-0000-000000000000
                      type: /subscriptions
                    - displayName: Subscription 5 Tenant 2
                      id: /subscriptions/20000000-F005-0000-0000-000000000000
                      name: 20000000-F005-0000-0000-000000000000
                      type: /subscriptions
                    - displayName: Subscription 3 Tenant 3
                      id: /subscriptions/30000000-F003-0000-0000-000000000000
                      name: 30000000-F003-0000-0000-000000000000
                      type: /subscriptions
                  details:
                    parent:
                      displayName: 20000000-0000-0000-0000-000000000000
                      id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                      name: 20000000-0000-0000-0000-000000000000
                    updatedBy: Test
                    updatedTime: 2018-01-01T00:00:00.00Z
                    version: 1
                  displayName: Group 1 Tenant 2
                  tenantId: 20000000-0000-0000-0000-000000000000
                type: /providers/Microsoft.Management/managementGroups
        GetManagementGroupsWithExpandAndRecurse:
          parameters:
            $expand: children
            $recurse: true
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: 20000000-0001-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /providers/Microsoft.Management/managementGroups/RootGroup
                name: RootGroup
                properties:
                  children:
                    - children:
                        - children:
                            - displayName: Pay-As-You-Go
                              id: /subscriptions/728bcbe4-8d56-4510-86c2-4921b8beefbc
                              name: 728bcbe4-8d56-4510-86c2-4921b8beefbc
                              roles:
                                - /providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635
                              type: /subscriptions
                          displayName: Leaf
                          id: /providers/Microsoft.Management/managementGroups/Leaf
                          name: Leaf
                          roles:
                            - /providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635
                          type: /providers/Microsoft.Management/managementGroups
                      displayName: Child
                      id: /providers/Microsoft.Management/managementGroups/Child
                      name: Child
                      roles:
                        - /providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635
                      type: /providers/Microsoft.Management/managementGroups
                    - displayName: Leaf
                      id: /providers/Microsoft.Management/managementGroups/AnotherChild
                      name: AnotherChild
                      roles:
                        - /providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635
                      type: /providers/Microsoft.Management/managementGroups
                  details:
                    parent:
                      displayName: 20000000-0000-0000-0000-000000000000
                      id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                      name: 20000000-0000-0000-0000-000000000000
                    updatedBy: bd490e30-04cb-433e-b8c8-6066959a8bab
                    updatedTime: 2018-01-25T02:26:49.0022093Z
                    version: 2
                  displayName: RootGroup
                  tenantId: 20000000-0000-0000-0000-000000000000
                type: /providers/Microsoft.Management/managementGroups
    patch:
      description: Update a management group.
      operationId: ManagementGroups_Update
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
        - $ref: "#/parameters/PatchGroupRequestParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ManagementGroup"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        PatchManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: ChildGroup
            patchGroupRequest:
              displayName: AlternateDisplayName
              parentGroupId: /providers/Microsoft.Management/managementGroups/AlternateRootGroup
          responses:
            "200":
              body:
                id: /providers/Microsoft.Management/managementGroups/ChildGroup
                name: ChildGroup
                properties:
                  details:
                    parent:
                      displayName: AlternateRootGroup
                      id: /providers/Microsoft.Management/managementGroups/AlternateRootGroup
                      name: AlternateRootGroup
                    updatedBy: bd490e30-04cb-433e-b8c8-6066959a8bab
                    updatedTime: 2018-01-25T02:46:59.0545645Z
                    version: 2
                  displayName: AlternateDisplayName
                  tenantId: 20000000-0000-0000-0000-000000000000
                type: /providers/Microsoft.Management/managementGroups
    put:
      description: Create or update a management group. If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated.
      operationId: ManagementGroups_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
        - $ref: "#/parameters/CreateManagementGroupRequestParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ManagementGroup"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/OperationResults"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        PutManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            createManagementGroupRequest:
              id: /providers/Microsoft.Management/managementGroups/ChildGroup
              name: ChildGroup
              properties:
                details:
                  parent:
                    id: /providers/Microsoft.Management/managementGroups/RootGroup
                displayName: ChildGroup
                tenantId: 20000000-0000-0000-0000-000000000000
              type: /providers/Microsoft.Management/managementGroups
            groupId: ChildGroup
          responses:
            "200":
              body:
                id: /providers/Microsoft.Management/managementGroups/ChildGroup
                name: ChildGroup
                properties:
                  details:
                    parent:
                      displayName: RootGroup
                      id: /providers/Microsoft.Management/managementGroups/RootGroup
                      name: RootGroup
                    updatedBy: 16b8ef21-5c9f-420c-bcc9-e4f8c9f30b4b
                    updatedTime: 2018-01-01T00:00:00.00Z
                    version: 1
                  displayName: ChildGroup
                  tenantId: 20000000-0000-0000-0000-000000000000
                type: /providers/Microsoft.Management/managementGroups
            "202":
              body:
                id: /providers/Microsoft.Management/managementGroups/ChildGroup
                name: ChildGroup
                properties:
                  provisioningState: Updating
                type: /providers/Microsoft.Management/managementGroups
      x-ms-long-running-operation: true
  "/providers/Microsoft.Management/managementGroups/{groupId}/descendants":
    get:
      description: |
        List all entities that descend from a management group.
      operationId: ManagementGroups_GetDescendants
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SkipTokenParameter"
        - $ref: "#/parameters/TopParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DescendantListResult"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups_Descendants
      x-ms-examples:
        GetDescendants:
          parameters:
            api-version: 2018-03-01-preview
            groupId: 20000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                nextLink: null
                value:
                  - id: /providers/Microsoft.Management/managementGroups/20000000-0001-0000-0000-000000000000
                    name: 20000000-0001-0000-0000-000000000000
                    properties:
                      displayName: Group 1
                      parent:
                        id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                    type: /providers/Microsoft.Management/managementGroups
                  - id: /subscriptions/20000000-0004-0000-0000-000000000000
                    name: 20000000-0004-0000-0000-000000000000
                    properties:
                      displayName: Subscription 4
                      parent:
                        id: /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
                    type: /subscriptions
      x-ms-pageable:
        nextLinkName: nextLink
  "/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}":
    delete:
      description: De-associates subscription from the management group.
      operationId: ManagementGroupSubscriptions_Delete
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
      responses:
        "204":
          description: NoContent
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        DeleteSubscriptionFromManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: Group
            subscriptionId: 728bcbe4-8d56-4510-86c2-4921b8beefbc
          responses:
            "204": {}
    put:
      description: Associates existing subscription with the management group.
      operationId: ManagementGroupSubscriptions_Create
      parameters:
        - $ref: "#/parameters/GroupIdParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/CacheControlHeader"
      responses:
        "204":
          description: NoContent
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - ManagementGroups
      x-ms-examples:
        AddSubscriptionToManagementGroup:
          parameters:
            Cache-Control: no-cache
            api-version: 2018-03-01-preview
            groupId: Group
            subscriptionId: 728bcbe4-8d56-4510-86c2-4921b8beefbc
          responses:
            "204": {}
  /providers/Microsoft.Management/operations:
    get:
      description: Lists all of the available Management REST API operations.
      operationId: Operations_List
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK. The request has succeeded.
          schema:
            $ref: "#/definitions/OperationListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Operations
      x-ms-pageable:
        nextLinkName: nextLink
  /providers/Microsoft.Management/startTenantBackfill:
    post:
      description: Starts backfilling subscriptions for the Tenant.
      operationId: StartTenantBackfill
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK. The request has succeeded.
          schema:
            $ref: "#/definitions/TenantBackfillStatusResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - TenantBackfill
      x-ms-examples:
        StartTenantBackfill:
          parameters:
            api-version: 2018-03-01-preview
            startTenantBackfillRequest: {}
          responses:
            "200":
              body:
                status: Started
                tenantId: 20000000-0000-0000-0000-000000000000
  /providers/Microsoft.Management/tenantBackfillStatus:
    post:
      description: Gets tenant backfill status
      operationId: TenantBackfillStatus
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK. The request has succeeded.
          schema:
            $ref: "#/definitions/TenantBackfillStatusResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - TenantBackfill
      x-ms-examples:
        TenantBackfillStatus:
          parameters:
            api-version: 2018-03-01-preview
            tenantBackfillStatusRequest: {}
          responses:
            "200":
              body:
                status: Started
                tenantId: 20000000-0000-0000-0000-000000000000
definitions:
  CheckNameAvailabilityRequest:
    description: Management group name availability check parameters.
    properties:
      name:
        description: the name to check for availability
        type: string
      type:
        description: fully qualified resource type which includes provider namespace
        enum:
          - /providers/Microsoft.Management/managementGroups
        type: string
        x-ms-enum:
          modelAsString: false
          name: Type
          values:
            - value: /providers/Microsoft.Management/managementGroups
    type: object
  CheckNameAvailabilityResult:
    description: Describes the result of the request to check management group name availability.
    properties:
      message:
        description: Required if nameAvailable == false. Localized. If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name.
        readOnly: true
        type: string
      nameAvailable:
        description: Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both.
        readOnly: true
        type: boolean
      reason:
        description: Required if nameAvailable == false. Invalid indicates the name provided does not match the resource provider's naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable.
        enum:
          - Invalid
          - AlreadyExists
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: false
          name: Reason
          values:
            - value: Invalid
            - value: AlreadyExists
  CreateManagementGroupChildInfo:
    description: The child information of a management group used during creation.
    properties:
      children:
        description: The list of children.
        items:
          $ref: "#/definitions/CreateManagementGroupChildInfo"
        readOnly: true
        type: array
      displayName:
        description: The friendly name of the child resource.
        readOnly: true
        type: string
      id:
        description: The fully qualified ID for the child resource (management group or subscription).  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the child entity.
        readOnly: true
        type: string
      roles:
        description: The roles definitions associated with the management group.
        items:
          type: string
        readOnly: true
        type: array
      type:
        $ref: "#/definitions/ManagementGroupChildType"
        description: The fully qualified resource type which includes provider namespace (e.g. /providers/Microsoft.Management/managementGroups)
        readOnly: true
        title: The type of child resource.
  CreateManagementGroupDetails:
    description: The details of a management group used during creation.
    properties:
      parent:
        $ref: "#/definitions/CreateParentGroupInfo"
        title: Parent
      updatedBy:
        description: The identity of the principal or process that updated the object.
        readOnly: true
        type: string
      updatedTime:
        description: The date and time when this object was last updated.
        format: date-time
        readOnly: true
        type: string
      version:
        description: The version number of the object.
        format: int32
        readOnly: true
        type: number
    type: object
  CreateManagementGroupProperties:
    description: The generic properties of a management group used during creation.
    properties:
      children:
        description: The list of children.
        items:
          $ref: "#/definitions/CreateManagementGroupChildInfo"
        readOnly: true
        type: array
        x-nullable: true
      details:
        $ref: "#/definitions/CreateManagementGroupDetails"
        title: Details
      displayName:
        description: The friendly name of the management group. If no value is passed then this  field will be set to the groupId.
        type: string
        x-nullable: true
      roles:
        description: The roles definitions associated with the management group.
        items:
          type: string
        readOnly: true
        type: array
        x-nullable: true
      tenantId:
        description: The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
    type: object
  CreateManagementGroupRequest:
    description: Management group creation parameters.
    properties:
      id:
        description: The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the management group. For example, 00000000-0000-0000-0000-000000000000
        type: string
      properties:
        $ref: "#/definitions/CreateManagementGroupProperties"
        title: Properties
        x-ms-client-flatten: true
      type:
        description: The type of the resource.  For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
    type: object
    x-ms-azure-resource: true
  CreateParentGroupInfo:
    description: (Optional) The ID of the parent management group used during creation.
    properties:
      displayName:
        description: The friendly name of the parent management group.
        readOnly: true
        type: string
      id:
        description: The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
      name:
        description: The name of the parent management group
        readOnly: true
        type: string
  DescendantInfo:
    description: The descendant.
    properties:
      id:
        description: The fully qualified ID for the descendant.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or /subscriptions/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
        x-nullable: true
      name:
        description: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/DescendantInfoProperties"
        title: Properties
        x-ms-client-flatten: true
        x-nullable: true
      type:
        description: The type of the resource. For example, /providers/Microsoft.Management/managementGroups or /subscriptions
        readOnly: true
        type: string
        x-nullable: true
  DescendantInfoProperties:
    description: The generic properties of an descendant.
    properties:
      displayName:
        description: The friendly name of the management group.
        type: string
        x-nullable: true
      parent:
        $ref: "#/definitions/DescendantParentGroupInfo"
        title: Parent
        x-nullable: true
    type: object
  DescendantListResult:
    description: Describes the result of the request to view descendants.
    properties:
      nextLink:
        description: The URL to use for getting the next set of results.
        readOnly: true
        type: string
      value:
        description: The list of descendants.
        items:
          $ref: "#/definitions/DescendantInfo"
        type: array
  DescendantParentGroupInfo:
    description: The ID of the parent management group.
    properties:
      id:
        description: The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
  EntityHierarchyItem:
    description: The management group details for the hierarchy view.
    properties:
      id:
        description: The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/EntityHierarchyItemProperties"
        title: Properties
        x-ms-client-flatten: true
      type:
        description: The type of the resource.  For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
    x-ms-azure-resource: true
  EntityHierarchyItemProperties:
    description: The generic properties of a management group.
    properties:
      children:
        description: The list of children.
        items:
          $ref: "#/definitions/EntityHierarchyItem"
        type: array
        x-nullable: true
      displayName:
        description: The friendly name of the management group.
        type: string
      permissions:
        $ref: "#/definitions/Permissions"
        title: Permissions
    type: object
  EntityInfo:
    description: The entity.
    properties:
      id:
        description: The fully qualified ID for the entity.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
        x-nullable: true
      name:
        description: The name of the entity. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/EntityInfoProperties"
        title: Properties
        x-ms-client-flatten: true
        x-nullable: true
      type:
        description: The type of the resource. For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
        x-nullable: true
  EntityInfoProperties:
    description: The generic properties of an entity.
    properties:
      displayName:
        description: The friendly name of the management group.
        type: string
        x-nullable: true
      inheritedPermissions:
        $ref: "#/definitions/Permissions"
        title: Inherited Permissions
        x-nullable: true
      numberOfChildGroups:
        description: Number of child groups is the number of Groups that are exactly one level underneath the current Group.
        title: Number of Child Groups
        type: integer
        x-nullable: true
      numberOfChildren:
        description: Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current Group.
        title: Number of Children
        type: integer
        x-nullable: true
      numberOfDescendants:
        title: Number of Descendants
        type: integer
        x-nullable: true
      parent:
        $ref: "#/definitions/EntityParentGroupInfo"
        title: Parent
        x-nullable: true
      parentDisplayNameChain:
        description: The parent display name chain from the root group to the immediate parent
        items:
          type: string
        type: array
        x-nullable: true
      parentNameChain:
        description: The parent name chain from the root group to the immediate parent
        items:
          type: string
        type: array
        x-nullable: true
      permissions:
        $ref: "#/definitions/Permissions"
        title: Permissions
        x-nullable: true
      tenantId:
        description: The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000
        type: string
        x-nullable: true
    type: object
  EntityListResult:
    description: Describes the result of the request to view entities.
    properties:
      count:
        description: Total count of records that match the filter
        readOnly: true
        type: integer
      nextLink:
        description: The URL to use for getting the next set of results.
        readOnly: true
        type: string
      value:
        description: The list of entities.
        items:
          $ref: "#/definitions/EntityInfo"
        type: array
  EntityParentGroupInfo:
    description: (Optional) The ID of the parent management group.
    properties:
      id:
        description: The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
  ErrorDetails:
    description: The details of the error.
    properties:
      code:
        description: One of a server-defined set of error codes.
        type: string
      details:
        description: A human-readable representation of the error's details.
        type: string
      message:
        description: A human-readable representation of the error.
        type: string
  ErrorResponse:
    description: The error object.
    properties:
      error:
        $ref: "#/definitions/ErrorDetails"
        title: Error
  ManagementGroup:
    description: The management group details.
    properties:
      id:
        description: The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/ManagementGroupProperties"
        title: Properties
        x-ms-client-flatten: true
      type:
        description: The type of the resource.  For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
    x-ms-azure-resource: true
  ManagementGroupChildInfo:
    description: The child information of a management group.
    properties:
      children:
        description: The list of children.
        items:
          $ref: "#/definitions/ManagementGroupChildInfo"
        type: array
      displayName:
        description: The friendly name of the child resource.
        type: string
      id:
        description: The fully qualified ID for the child resource (management group or subscription).  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
      name:
        description: The name of the child entity.
        type: string
      roles:
        description: The roles definitions associated with the management group.
        items:
          type: string
        type: array
      type:
        $ref: "#/definitions/ManagementGroupChildType"
        description: The fully qualified resource type which includes provider namespace (e.g. /providers/Microsoft.Management/managementGroups)
        title: The type of child resource.
  ManagementGroupChildType:
    description: The type of child resource.
    enum:
      - /providers/Microsoft.Management/managementGroups
      - /subscriptions
    type: string
  ManagementGroupDetails:
    description: The details of a management group.
    properties:
      parent:
        $ref: "#/definitions/ParentGroupInfo"
        title: Parent
      updatedBy:
        description: The identity of the principal or process that updated the object.
        type: string
      updatedTime:
        description: The date and time when this object was last updated.
        format: date-time
        type: string
      version:
        description: The version number of the object.
        format: int32
        type: number
    type: object
  ManagementGroupInfo:
    description: The management group resource.
    properties:
      id:
        description: The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/ManagementGroupInfoProperties"
        title: Properties
        x-ms-client-flatten: true
      type:
        description: The type of the resource. For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
  ManagementGroupInfoProperties:
    description: The generic properties of a management group.
    properties:
      displayName:
        description: The friendly name of the management group.
        type: string
      tenantId:
        description: The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
        type: string
    type: object
  ManagementGroupListResult:
    description: Describes the result of the request to list management groups.
    properties:
      nextLink:
        description: The URL to use for getting the next set of results.
        readOnly: true
        type: string
      value:
        description: The list of management groups.
        items:
          $ref: "#/definitions/ManagementGroupInfo"
        type: array
  ManagementGroupProperties:
    description: The generic properties of a management group.
    properties:
      children:
        description: The list of children.
        items:
          $ref: "#/definitions/ManagementGroupChildInfo"
        type: array
        x-nullable: true
      details:
        $ref: "#/definitions/ManagementGroupDetails"
        title: Details
      displayName:
        description: The friendly name of the management group.
        type: string
      roles:
        description: The role definitions associated with the management group.
        items:
          type: string
        type: array
        x-nullable: true
      tenantId:
        description: The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
        type: string
    type: object
  Operation:
    description: Operation supported by the Microsoft.Management resource provider.
    properties:
      display:
        $ref: "#/definitions/OperationDisplayProperties"
        title: Display
      name:
        description: "Operation name: {provider}/{resource}/{operation}."
        readOnly: true
        type: string
    type: object
  OperationDisplayProperties:
    description: The object that represents the operation.
    properties:
      description:
        description: Operation description.
        readOnly: true
        type: string
      operation:
        description: The operation that can be performed.
        readOnly: true
        type: string
      provider:
        description: The name of the provider.
        readOnly: true
        type: string
      resource:
        description: The resource on which the operation is performed.
        readOnly: true
        type: string
  OperationListResult:
    description: Describes the result of the request to list Microsoft.Management operations.
    properties:
      nextLink:
        description: URL to get the next set of operation list results if there are any.
        readOnly: true
        type: string
      value:
        description: List of operations supported by the Microsoft.Management resource provider.
        items:
          $ref: "#/definitions/Operation"
        readOnly: true
        type: array
  OperationResults:
    description: The results of an asynchronous operation.
    properties:
      id:
        description: The fully qualified ID for the management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      name:
        description: The name of the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
      properties:
        properties:
          provisioningState:
            $ref: "#/definitions/ProvisioningState"
            title: Provisioning State
        title: Properties
        type: object
        x-ms-client-flatten: true
      type:
        description: The type of the resource.  For example, /providers/Microsoft.Management/managementGroups
        readOnly: true
        type: string
  ParentGroupInfo:
    description: (Optional) The ID of the parent management group.
    properties:
      displayName:
        description: The friendly name of the parent management group.
        type: string
      id:
        description: The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
      name:
        description: The name of the parent management group
        type: string
  PatchManagementGroupRequest:
    description: Management group patch parameters.
    properties:
      displayName:
        description: The friendly name of the management group.
        type: string
        x-nullable: true
      parentId:
        description: (Optional) The fully qualified ID for the parent management group.  For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
        type: string
        x-nullable: true
    type: object
  Permissions:
    description: The users specific permissions to this item.
    enum:
      - noaccess
      - view
      - edit
      - delete
    type: string
  ProvisioningState:
    description: The provisioning status.
    enum:
      - Updating
    title: Provisioning State
    type: string
  TenantBackfillStatusResult:
    description: The tenant backfill status
    properties:
      status:
        description: The status of the Tenant Backfill
        enum:
          - NotStarted
          - NotStartedButGroupsExist
          - Started
          - Failed
          - Cancelled
          - Completed
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: false
          name: Status
          values:
            - value: NotStarted
            - value: NotStartedButGroupsExist
            - value: Started
            - value: Failed
            - value: Cancelled
            - value: Completed
      tenantId:
        description: The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
        readOnly: true
        type: string
