Condividi tramite


PolicyAssignmentsOperationsExtensions.CreateById Method

Definition

Creates or updates a policy assignment.

public static Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment CreateById (this Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations operations, string policyAssignmentId, Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment parameters);
static member CreateById : Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations * string * Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment -> Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment
<Extension()>
Public Function CreateById (operations As IPolicyAssignmentsOperations, policyAssignmentId As String, parameters As PolicyAssignment) As 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.

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