Required. The parent resource name in the form: projects/{project}/locations/{location}. Note: Specify the zone of your VMs as the location.
Query parameters
Parameters
osPolicyAssignmentId
string
Required. The logical name of the OS policy assignment in the project with the following restrictions:
Must contain only lowercase letters, numbers, and hyphens.
Must start with a letter.
Must be between 1-63 characters.
Must end with a number or a letter.
Must be unique within the project.
requestId
string
Optional. A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is only idempotent if a requestId is provided.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-28 UTC."],[[["\u003cp\u003eThis process details how to create an OS policy assignment, which also automatically generates the initial revision of the assignment.\u003c/p\u003e\n"],["\u003cp\u003eThe method uses a long-running operation (LRO) that provides rollout details, and the rollout is cancellable through the LRO.\u003c/p\u003e\n"],["\u003cp\u003eThe required URL to create an OS policy assignment is provided using the \u003ccode\u003ePOST\u003c/code\u003e method with a specific parent path parameter and query parameters like \u003ccode\u003eosPolicyAssignmentId\u003c/code\u003e and optional \u003ccode\u003erequestId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body contains the details of the OS policy assignment, and a successful response returns an \u003ccode\u003eOperation\u003c/code\u003e instance, showing the progress of the created task.\u003c/p\u003e\n"],["\u003cp\u003eTo execute this action, you will require the OAuth scope \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e and the IAM permission \u003ccode\u003eosconfig.osPolicyAssignments.create\u003c/code\u003e on the parent resource.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.osPolicyAssignments.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [IAM Permissions](#body.aspect_1)\n- [Try it!](#try-it)\n\nCreate an OS policy assignment.\n\nThis method also creates the first revision of the OS policy assignment.\n\nThis method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.\n\nFor more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).\n\n### HTTP request\n\n`POST https://osconfig.googleapis.com/v1/{parent=projects/*/locations/*}/osPolicyAssignments`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Query parameters\n\n### Request body\n\nThe request body contains an instance of [OSPolicyAssignment](/compute/docs/osconfig/rest/Shared.Types/OSPolicyAssignment).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Operation](/compute/docs/osconfig/rest/Shared.Types/ListOperationsResponse#Operation).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\n### IAM Permissions\n\nRequires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:\n\n- `osconfig.osPolicyAssignments.create`\n\nFor more information, see the [IAM documentation](https://cloud.google.com/iam/docs)."]]