MockableResourcesPolicyTenantResource.DeleteByIdAsync Method

Definition

This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource).

  • Request Path. : /{policyAssignmentId}.
  • Operation Id. : Authorization_DeleteById.
  • Default Api Version. : 2025-12-01-preview.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>> DeleteByIdAsync(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>>
override this.DeleteByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>>
Public Overridable Function DeleteByIdAsync (policyAssignmentId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of PolicyAssignmentResource))

Parameters

policyAssignmentId
String

The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

policyAssignmentId is null.

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

Applies to