Share via


Policy.PolicyAssignmentsListForResource Method

Definition

This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=atExactScope() is provided, the returned list only includes all policy assignments that at the resource level. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp').

public System.Threading.Tasks.Task PolicyAssignmentsListForResource (string subscriptionId, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string Filter, int? Top, Func<System.Net.Http.HttpResponseMessage,System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyAssignmentListResult>,System.Threading.Tasks.Task> onOk, Func<System.Net.Http.HttpResponseMessage,System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.ICloudError>,System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.ISendAsync sender);
member this.PolicyAssignmentsListForResource : string * string * string * string * string * string * string * Nullable<int> * Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyAssignmentListResult>, System.Threading.Tasks.Task> * Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.ICloudError>, System.Threading.Tasks.Task> * Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.IEventListener * Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.ISendAsync -> System.Threading.Tasks.Task
Public Function PolicyAssignmentsListForResource (subscriptionId As String, resourceGroupName As String, resourceProviderNamespace As String, parentResourcePath As String, resourceType As String, resourceName As String, Filter As String, Top As Nullable(Of Integer), onOk As Func(Of HttpResponseMessage, Task(Of IPolicyAssignmentListResult), Task), onDefault As Func(Of HttpResponseMessage, Task(Of ICloudError), Task), eventListener As IEventListener, sender As ISendAsync) As Task

Parameters

subscriptionId
String

The ID of the target subscription. The value must be an UUID.

resourceGroupName
String

The name of the resource group containing the resource.

resourceProviderNamespace
String

The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines)

parentResourcePath
String

The parent resource path. Use empty string if there is none.

resourceType
String

The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites).

resourceName
String

The name of the resource.

Filter
String

The filter to apply on the operation. Valid values for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atScope() is provided, the returned list only includes all policy assignments that apply to the scope, which is everything in the unfiltered list except those applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, the returned list only includes all policy assignments that at the given scope. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}.

Top
Nullable<Int32>

Maximum number of records to return. When the $top filter is not provided, it will return 500 records.

onOk
Func<HttpResponseMessage,Task<IPolicyAssignmentListResult>,Task>

a delegate that is called when the remote service returns 200 (OK).

onDefault
Func<HttpResponseMessage,Task<ICloudError>,Task>

a delegate that is called when the remote service returns default (any response code not handled elsewhere).

eventListener
IEventListener

an IEventListener instance that will receive events.

sender
ISendAsync

an instance of an Microsoft.Azure.PowerShell.Cmdlets.Policy.Runtime.ISendAsync pipeline to use to make the request.

Returns

A Task that will be complete when handling of the response is completed.

Applies to