PolicyAssignmentCollection.GetIfExists Method

Definition

Tries to get details for this resource from the service.

  • Request Path. : /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}.
  • Operation Id. : PolicyAssignments_Get.
  • Default Api Version. : 2025-12-01-preview.
public virtual Azure.NullableResponse<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource> GetIfExists(string policyAssignmentName, string expand = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetIfExists : string * string * System.Threading.CancellationToken -> Azure.NullableResponse<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>
override this.GetIfExists : string * string * System.Threading.CancellationToken -> Azure.NullableResponse<Azure.ResourceManager.Resources.Policy.PolicyAssignmentResource>
Public Overridable Function GetIfExists (policyAssignmentName As String, Optional expand As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As NullableResponse(Of PolicyAssignmentResource)

Parameters

policyAssignmentName
String

The name of the policy assignment to get.

expand
String

Comma-separated list of additional properties to be included in the response. Supported values are 'LatestDefinitionVersion, EffectiveDefinitionVersion'.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

policyAssignmentName is null.

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

Applies to