public sealed class OSPolicyAssignment : IMessage<OSPolicyAssignment>, IEquatable<OSPolicyAssignment>, IDeepCloneable<OSPolicyAssignment>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud OS Config v1 API class OSPolicyAssignment.
OS policy assignment is an API resource that is used to
apply a set of OS policies to a dynamically targeted group of Compute Engine
VM instances.
An OS policy is used to define the desired state configuration for a
Compute Engine VM instance through a set of configuration resources that
provide capabilities such as installing or removing software packages, or
executing a script.
public OSPolicyAssignment.Types.Rollout Rollout { get; set; }
Required. Rollout to deploy the OS policy assignment.
A rollout is triggered in the following situations:
1) OSPolicyAssignment is created.
2) OSPolicyAssignment is updated and the update contains changes to one of
the following fields:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eThis webpage provides reference documentation for the \u003ccode\u003eOSPolicyAssignment\u003c/code\u003e class within the Google Cloud OS Config v1 API, specifically for .NET.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOSPolicyAssignment\u003c/code\u003e is used to apply OS policies, which define desired configurations like software installations or script executions, to groups of Compute Engine VM instances.\u003c/p\u003e\n"],["\u003cp\u003eThis resource allows for managing the rollout of OS policies through revisions, tracking their rollout state, and filtering which VMs the policies should apply to.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eOSPolicyAssignment\u003c/code\u003e is \u003ccode\u003e2.4.0\u003c/code\u003e and it details the class properties, their types, and usage, including constructors, inherited members, and implementations.\u003c/p\u003e\n"],["\u003cp\u003eThis class can be used to manage OS policy deployment and deletion and details output values such as whether a revision is deployed, in progress or deleted.\u003c/p\u003e\n"]]],[],null,["# Google Cloud OS Config v1 API - Class OSPolicyAssignment (2.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.4.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.3.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.2.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.1.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.0.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.8.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.8.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.7.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.7.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.6.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.5.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.4.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.3.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment) \n\n public sealed class OSPolicyAssignment : IMessage\u003cOSPolicyAssignment\u003e, IEquatable\u003cOSPolicyAssignment\u003e, IDeepCloneable\u003cOSPolicyAssignment\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud OS Config v1 API class OSPolicyAssignment.\n\nOS policy assignment is an API resource that is used to\napply a set of OS policies to a dynamically targeted group of Compute Engine\nVM instances.\n\nAn OS policy is used to define the desired state configuration for a\nCompute Engine VM instance through a set of configuration resources that\nprovide capabilities such as installing or removing software packages, or\nexecuting a script.\n\nFor more information, see [OS policy and OS policy\nassignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies). \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OSPolicyAssignment \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.OsConfig.V1](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.OsConfig.V1.dll\n\nConstructors\n------------\n\n### OSPolicyAssignment()\n\n public OSPolicyAssignment()\n\n### OSPolicyAssignment(OSPolicyAssignment)\n\n public OSPolicyAssignment(OSPolicyAssignment other)\n\nProperties\n----------\n\n### Baseline\n\n public bool Baseline { get; set; }\n\nOutput only. Indicates that this revision has been successfully rolled out\nin this zone and new VMs will be assigned OS policies from this revision.\n\nFor a given OS policy assignment, there is only one revision with a value\nof `true` for this field.\n\n### Deleted\n\n public bool Deleted { get; set; }\n\nOutput only. Indicates that this revision deletes the OS policy assignment.\n\n### Description\n\n public string Description { get; set; }\n\nOS policy assignment description.\nLength of the description is limited to 1024 characters.\n\n### Etag\n\n public string Etag { get; set; }\n\nThe etag for this OS policy assignment.\nIf this is provided on update, it must match the server's etag.\n\n### InstanceFilter\n\n public OSPolicyAssignment.Types.InstanceFilter InstanceFilter { get; set; }\n\nRequired. Filter to select VMs.\n\n### Name\n\n public string Name { get; set; }\n\nResource name.\n\nFormat:\n`projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`\n\nThis field is ignored when you create an OS policy assignment.\n\n### OSPolicyAssignmentName\n\n public OSPolicyAssignmentName OSPolicyAssignmentName { get; set; }\n\n[OSPolicyAssignmentName](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignmentName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment#Google_Cloud_OsConfig_V1_OSPolicyAssignment_Name) resource name property.\n\n### OsPolicies\n\n public RepeatedField\u003cOSPolicy\u003e OsPolicies { get; }\n\nRequired. List of OS policies to be applied to the VMs.\n\n### Reconciling\n\n public bool Reconciling { get; set; }\n\nOutput only. Indicates that reconciliation is in progress for the revision.\nThis value is `true` when the `rollout_state` is one of:\n\n- IN_PROGRESS\n- CANCELLING\n\n### RevisionCreateTime\n\n public Timestamp RevisionCreateTime { get; set; }\n\nOutput only. The timestamp that the revision was created.\n\n### RevisionId\n\n public string RevisionId { get; set; }\n\nOutput only. The assignment revision ID\nA new revision is committed whenever a rollout is triggered for a OS policy\nassignment\n\n### Rollout\n\n public OSPolicyAssignment.Types.Rollout Rollout { get; set; }\n\nRequired. Rollout to deploy the OS policy assignment.\nA rollout is triggered in the following situations:\n1) OSPolicyAssignment is created.\n2) OSPolicyAssignment is updated and the update contains changes to one of\nthe following fields:\n\n- instance_filter\n- os_policies 3) OSPolicyAssignment is deleted.\n\n### RolloutState\n\n public OSPolicyAssignment.Types.RolloutState RolloutState { get; set; }\n\nOutput only. OS policy assignment rollout state\n\n### Uid\n\n public string Uid { get; set; }\n\nOutput only. Server generated unique id for the OS policy assignment\nresource."]]