MockableResourcesPolicyTenantResource.GetByIdAsync Method

Definition

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

  • Request Path. : /{policyAssignmentId}.
  • Operation Id. : Authorization_GetById.
  • Default Api Version. : 2025-12-01-preview.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>> GetByIdAsync(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>>
override this.GetByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>>
Public Overridable Function GetByIdAsync (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