MockableResourcesPolicyTenantResource.GetById 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 Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource> GetById(string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetById : string * System.Threading.CancellationToken -> Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>
override this.GetById : string * System.Threading.CancellationToken -> Azure.Response<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>
Public Overridable Function GetById (policyAssignmentId As String, Optional cancellationToken As CancellationToken = Nothing) As 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