IPolicyAssignmentsOperations.CreateWithHttpMessagesAsync 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 System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner>> CreateWithHttpMessagesAsync (string scope, string policyAssignmentName, Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner parameters, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateWithHttpMessagesAsync : string * string * Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner>>
Public Function CreateWithHttpMessagesAsync (scope As String, policyAssignmentName As String, parameters As PolicyAssignmentInner, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(Of PolicyAssignmentInner))
Parameters
- scope
- String
The scope of the policy assignment. 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}'
- policyAssignmentName
- String
The name of the policy assignment.
- parameters
- PolicyAssignmentInner
Parameters for the policy assignment.
- customHeaders
- Dictionary<String,List<String>>
The headers that will be added to request.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
Exceptions
Thrown when the operation returned an invalid status code
Thrown when unable to deserialize the response
Thrown when a required parameter is null
Remarks
This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.
Applies to
Azure SDK for .NET