PolicyAssignmentsOperationsExtensions.CreateByIdAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates or updates a policy assignment.
public static System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment> CreateByIdAsync (this Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations operations, string policyAssignmentId, Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateByIdAsync : Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations * string * Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment>
<Extension()>
Public Function CreateByIdAsync (operations As IPolicyAssignmentsOperations, policyAssignmentId As String, parameters As PolicyAssignment, Optional cancellationToken As CancellationToken = Nothing) As Task(Of PolicyAssignment)
Parameters
- operations
- IPolicyAssignmentsOperations
The operations group for this extension method.
- policyAssignmentId
- String
The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
- parameters
- PolicyAssignment
Parameters for policy assignment.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
Remarks
This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. 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}'.
Applies to
Azure SDK for .NET