Table of Contents

Class ManagementGroupCollection

Namespace
Azure.ResourceManager.ManagementGroups
Assembly
Azure.ResourceManager.dll

A class representing a collection of ManagementGroupResource and their operations. Each ManagementGroupResource in the collection will belong to the same instance of TenantResource. To get a ManagementGroupCollection instance call the GetManagementGroups method from an instance of TenantResource.

public class ManagementGroupCollection : ArmCollection, IEnumerable<ManagementGroupResource>, IEnumerable, IAsyncEnumerable<ManagementGroupResource>
Inheritance
ManagementGroupCollection
Implements
IAsyncEnumerable<ManagementGroupResource>
Inherited Members

Constructors

ManagementGroupCollection()

Initializes a new instance of the ManagementGroupCollection class for mocking.

protected ManagementGroupCollection()

Methods

CheckNameAvailability(ManagementGroupNameAvailabilityContent, CancellationToken)

Checks if the specified management group name is valid and unique

  • Request Path/providers/Microsoft.Management/checkNameAvailability
  • Operation IdManagementGroups_CheckNameAvailability
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Response<ManagementGroupNameAvailabilityResult> CheckNameAvailability(ManagementGroupNameAvailabilityContent content, CancellationToken cancellationToken = default)

Parameters

content ManagementGroupNameAvailabilityContent

Management group name availability check parameters.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ManagementGroupNameAvailabilityResult>

Exceptions

ArgumentNullException

content is null.

CheckNameAvailabilityAsync(ManagementGroupNameAvailabilityContent, CancellationToken)

Checks if the specified management group name is valid and unique

  • Request Path/providers/Microsoft.Management/checkNameAvailability
  • Operation IdManagementGroups_CheckNameAvailability
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Task<Response<ManagementGroupNameAvailabilityResult>> CheckNameAvailabilityAsync(ManagementGroupNameAvailabilityContent content, CancellationToken cancellationToken = default)

Parameters

content ManagementGroupNameAvailabilityContent

Management group name availability check parameters.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ManagementGroupNameAvailabilityResult>>

Exceptions

ArgumentNullException

content is null.

CreateOrUpdate(WaitUntil, string, ManagementGroupCreateOrUpdateContent, string, CancellationToken)

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.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_CreateOrUpdate
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual ArmOperation<ManagementGroupResource> CreateOrUpdate(WaitUntil waitUntil, string groupId, ManagementGroupCreateOrUpdateContent content, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

groupId string

Management Group ID.

content ManagementGroupCreateOrUpdateContent

Management group creation parameters.

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<ManagementGroupResource>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId or content is null.

CreateOrUpdateAsync(WaitUntil, string, ManagementGroupCreateOrUpdateContent, string, CancellationToken)

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.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_CreateOrUpdate
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Task<ArmOperation<ManagementGroupResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, ManagementGroupCreateOrUpdateContent content, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

groupId string

Management Group ID.

content ManagementGroupCreateOrUpdateContent

Management group creation parameters.

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<ManagementGroupResource>>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId or content is null.

Exists(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Response<bool> Exists(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<bool>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.

ExistsAsync(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Task<Response<bool>> ExistsAsync(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<bool>>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.

Get(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Get the details of the management group.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Response<ManagementGroupResource> Get(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ManagementGroupResource>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.

GetAll(string, string, CancellationToken)

List management groups for the authenticated user.

  • Request Path/providers/Microsoft.Management/managementGroups
  • Operation IdManagementGroups_List
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Pageable<ManagementGroupResource> GetAll(string cacheControl = null, string skipToken = null, CancellationToken cancellationToken = default)

Parameters

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

skipToken string

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.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<ManagementGroupResource>

A collection of ManagementGroupResource that may take multiple service requests to iterate over.

GetAllAsync(string, string, CancellationToken)

List management groups for the authenticated user.

  • Request Path/providers/Microsoft.Management/managementGroups
  • Operation IdManagementGroups_List
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual AsyncPageable<ManagementGroupResource> GetAllAsync(string cacheControl = null, string skipToken = null, CancellationToken cancellationToken = default)

Parameters

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

skipToken string

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.

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<ManagementGroupResource>

An async collection of ManagementGroupResource that may take multiple service requests to iterate over.

GetAsync(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Get the details of the management group.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Task<Response<ManagementGroupResource>> GetAsync(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ManagementGroupResource>>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.

GetEntities(ManagementGroupCollectionGetEntitiesOptions, CancellationToken)

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

  • Request Path/providers/Microsoft.Management/getEntities
  • Operation IdEntities_List
  • Default Api Version2021-04-01
public virtual Pageable<EntityData> GetEntities(ManagementGroupCollectionGetEntitiesOptions options, CancellationToken cancellationToken = default)

Parameters

options ManagementGroupCollectionGetEntitiesOptions

A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<EntityData>

A collection of EntityData that may take multiple service requests to iterate over.

GetEntitiesAsync(ManagementGroupCollectionGetEntitiesOptions, CancellationToken)

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

  • Request Path/providers/Microsoft.Management/getEntities
  • Operation IdEntities_List
  • Default Api Version2021-04-01
public virtual AsyncPageable<EntityData> GetEntitiesAsync(ManagementGroupCollectionGetEntitiesOptions options, CancellationToken cancellationToken = default)

Parameters

options ManagementGroupCollectionGetEntitiesOptions

A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter.

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<EntityData>

An async collection of EntityData that may take multiple service requests to iterate over.

GetIfExists(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual NullableResponse<ManagementGroupResource> GetIfExists(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

NullableResponse<ManagementGroupResource>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.

GetIfExistsAsync(string, ManagementGroupExpandType?, bool?, string, string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/providers/Microsoft.Management/managementGroups/{groupId}
  • Operation IdManagementGroups_Get
  • Default Api Version2021-04-01
  • ResourceManagementGroupResource
public virtual Task<NullableResponse<ManagementGroupResource>> GetIfExistsAsync(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default)

Parameters

groupId string

Management Group ID.

expand ManagementGroupExpandType?

The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group.

recurse bool?

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.

filter string

A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription').

cacheControl string

Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<NullableResponse<ManagementGroupResource>>

Exceptions

ArgumentException

groupId is an empty string, and was expected to be non-empty.

ArgumentNullException

groupId is null.