AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the UpdatePolicy operation. Updates an existing policy with a new name, description, or content. If any parameter is not supplied, that value remains unchanged. Note that you cannot change a policy's type.

This operation can be called only from the organization's master account.

Inheritance Hierarchy


Namespace: Amazon.Organizations.Model
Assembly: AWSSDK.Organizations.dll
Version: 3.x.y.z


public class UpdatePolicyRequest : AmazonOrganizationsRequest

The UpdatePolicyRequest type exposes the following members


Public Method UpdatePolicyRequest()


Public Property Content System.String

Gets and sets the property Content.

If provided, the new content for the policy. The text must be correctly formatted JSON that complies with the syntax for the policy's type. For more information, see Service Control Policy Syntax in the AWS Organizations User Guide.

Public Property Description System.String

Gets and sets the property Description.

If provided, the new description for the policy.

Public Property Name System.String

Gets and sets the property Name.

If provided, the new name for the policy.

The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

Public Property PolicyId System.String

Gets and sets the property PolicyId.

The unique identifier (ID) of the policy that you want to update.

The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.


The following example shows how to rename a policy and give it a new description and new content. The output confirms the new name and description text:/n/n

To update the details of a policy

var response = client.UpdatePolicy(new UpdatePolicyRequest 
    Description = "This description replaces the original.",
    Name = "Renamed-Policy",
    PolicyId = "p-examplepolicyid111"

Policy policy = response.Policy;


The following example shows how to replace the JSON text of the SCP from the preceding example with a new JSON policy text string that allows S3 actions instead of EC2 actions:/n/n

To update the content of a policy

var response = client.UpdatePolicy(new UpdatePolicyRequest 
    Content = "{ \\"Version\\": \\"2012-10-17\\", \\"Statement\\": {\\"Effect\\": \\"Allow\\", \\"Action\\": \\"s3:*\\", \\"Resource\\": \\"*\\" } }",
    PolicyId = "p-examplepolicyid111"

Policy policy = response.Policy;


Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms