Table of Contents

Class ManagementGroupPolicyDefinitionCollection

Namespace
Azure.ResourceManager.Resources
Assembly
Azure.ResourceManager.dll

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

public class ManagementGroupPolicyDefinitionCollection : ArmCollection, IEnumerable<ManagementGroupPolicyDefinitionResource>, IEnumerable, IAsyncEnumerable<ManagementGroupPolicyDefinitionResource>
Inheritance
ManagementGroupPolicyDefinitionCollection
Implements
Inherited Members

Constructors

ManagementGroupPolicyDefinitionCollection()

Initializes a new instance of the ManagementGroupPolicyDefinitionCollection class for mocking.

protected ManagementGroupPolicyDefinitionCollection()

Methods

CreateOrUpdate(WaitUntil, string, PolicyDefinitionData, CancellationToken)

This operation creates or updates a policy definition in the given management group with the given name.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_CreateOrUpdateAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual ArmOperation<ManagementGroupPolicyDefinitionResource> CreateOrUpdate(WaitUntil waitUntil, string policyDefinitionName, PolicyDefinitionData data, 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.

policyDefinitionName string

The name of the policy definition to create.

data PolicyDefinitionData

The policy definition properties.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<ManagementGroupPolicyDefinitionResource>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName or data is null.

CreateOrUpdateAsync(WaitUntil, string, PolicyDefinitionData, CancellationToken)

This operation creates or updates a policy definition in the given management group with the given name.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_CreateOrUpdateAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Task<ArmOperation<ManagementGroupPolicyDefinitionResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string policyDefinitionName, PolicyDefinitionData data, 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.

policyDefinitionName string

The name of the policy definition to create.

data PolicyDefinitionData

The policy definition properties.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<ManagementGroupPolicyDefinitionResource>>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName or data is null.

Exists(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Response<bool> Exists(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<bool>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.

ExistsAsync(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Task<Response<bool>> ExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<bool>>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.

Get(string, CancellationToken)

This operation retrieves the policy definition in the given management group with the given name.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Response<ManagementGroupPolicyDefinitionResource> Get(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ManagementGroupPolicyDefinitionResource>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.

GetAll(string, int?, CancellationToken)

This operation retrieves a list of all the policy definitions in a given management group that match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list includes all policy definitions associated with the management group, including those that apply directly or from management groups that contain the given management group. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given management group. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions
  • Operation IdPolicyDefinitions_ListByManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Pageable<ManagementGroupPolicyDefinitionResource> GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given scope. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.

top int?

Maximum number of records to return. When the $top filter is not provided, it will return 500 records.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<ManagementGroupPolicyDefinitionResource>

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

GetAllAsync(string, int?, CancellationToken)

This operation retrieves a list of all the policy definitions in a given management group that match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list includes all policy definitions associated with the management group, including those that apply directly or from management groups that contain the given management group. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given management group. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions
  • Operation IdPolicyDefinitions_ListByManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual AsyncPageable<ManagementGroupPolicyDefinitionResource> GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given scope. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.

top int?

Maximum number of records to return. When the $top filter is not provided, it will return 500 records.

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<ManagementGroupPolicyDefinitionResource>

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

GetAsync(string, CancellationToken)

This operation retrieves the policy definition in the given management group with the given name.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Task<Response<ManagementGroupPolicyDefinitionResource>> GetAsync(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ManagementGroupPolicyDefinitionResource>>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.

GetIfExists(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual NullableResponse<ManagementGroupPolicyDefinitionResource> GetIfExists(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

NullableResponse<ManagementGroupPolicyDefinitionResource>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.

GetIfExistsAsync(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}
  • Operation IdPolicyDefinitions_GetAtManagementGroup
  • Default Api Version2021-06-01
  • ResourceManagementGroupPolicyDefinitionResource
public virtual Task<NullableResponse<ManagementGroupPolicyDefinitionResource>> GetIfExistsAsync(string policyDefinitionName, CancellationToken cancellationToken = default)

Parameters

policyDefinitionName string

The name of the policy definition to get.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<NullableResponse<ManagementGroupPolicyDefinitionResource>>

Exceptions

ArgumentException

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

ArgumentNullException

policyDefinitionName is null.