Table of Contents

Class PolicyAssignmentResource

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

A Class representing a PolicyAssignment along with the instance operations that can be performed on it. If you have a Azure.Core.ResourceIdentifier you can construct a PolicyAssignmentResource from an instance of ArmClient using the GetPolicyAssignmentResource method. Otherwise you can get one from its parent resource ArmResource using the GetPolicyAssignment method.

public class PolicyAssignmentResource : ArmResource, IJsonModel<PolicyAssignmentData>, IPersistableModel<PolicyAssignmentData>
Inheritance
PolicyAssignmentResource
Implements
IPersistableModel<PolicyAssignmentData>
Inherited Members

Constructors

PolicyAssignmentResource()

Initializes a new instance of the PolicyAssignmentResource class for mocking.

protected PolicyAssignmentResource()

Fields

ResourceType

Gets the resource type for the operations.

public static readonly ResourceType ResourceType

Field Value

ResourceType

Properties

Data

Gets the data representing this Feature.

public virtual PolicyAssignmentData Data { get; }

Property Value

PolicyAssignmentData

Exceptions

InvalidOperationException

Throws if there is no data loaded in the current instance.

HasData

Gets whether or not the current instance has data.

public virtual bool HasData { get; }

Property Value

bool

Methods

CreateResourceIdentifier(string, string)

Generate the resource identifier of a PolicyAssignmentResource instance.

public static ResourceIdentifier CreateResourceIdentifier(string scope, string policyAssignmentName)

Parameters

scope string

The scope.

policyAssignmentName string

The policyAssignmentName.

Returns

ResourceIdentifier

Delete(WaitUntil, CancellationToken)

This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Delete
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual ArmOperation<PolicyAssignmentResource> Delete(WaitUntil waitUntil, 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.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<PolicyAssignmentResource>

DeleteAsync(WaitUntil, CancellationToken)

This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Delete
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Task<ArmOperation<PolicyAssignmentResource>> DeleteAsync(WaitUntil waitUntil, 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.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<PolicyAssignmentResource>>

Get(CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Get
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Response<PolicyAssignmentResource> Get(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<PolicyAssignmentResource>

GetAsync(CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Get
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Task<Response<PolicyAssignmentResource>> GetAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<PolicyAssignmentResource>>

Update(PolicyAssignmentPatch, CancellationToken)

This operation updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Update
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Response<PolicyAssignmentResource> Update(PolicyAssignmentPatch patch, CancellationToken cancellationToken = default)

Parameters

patch PolicyAssignmentPatch

Parameters for policy assignment patch request.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<PolicyAssignmentResource>

Exceptions

ArgumentNullException

patch is null.

Update(WaitUntil, PolicyAssignmentData, CancellationToken)

This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Create
public virtual ArmOperation<PolicyAssignmentResource> Update(WaitUntil waitUntil, PolicyAssignmentData 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.

data PolicyAssignmentData

Parameters for the policy assignment.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<PolicyAssignmentResource>

Exceptions

ArgumentNullException

data is null.

UpdateAsync(PolicyAssignmentPatch, CancellationToken)

This operation updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Update
  • Default Api Version2022-06-01
  • ResourcePolicyAssignmentResource
public virtual Task<Response<PolicyAssignmentResource>> UpdateAsync(PolicyAssignmentPatch patch, CancellationToken cancellationToken = default)

Parameters

patch PolicyAssignmentPatch

Parameters for policy assignment patch request.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<PolicyAssignmentResource>>

Exceptions

ArgumentNullException

patch is null.

UpdateAsync(WaitUntil, PolicyAssignmentData, CancellationToken)

This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.

  • Request Path/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation IdPolicyAssignments_Create
public virtual Task<ArmOperation<PolicyAssignmentResource>> UpdateAsync(WaitUntil waitUntil, PolicyAssignmentData 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.

data PolicyAssignmentData

Parameters for the policy assignment.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<PolicyAssignmentResource>>

Exceptions

ArgumentNullException

data is null.