import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Applies a Guest Configuration Policy to a Virtual Machine. * * > **Note:** You can create Guest Configuration Policies without defining a `azure.compute.Extension` resource, however the policies will not be executed until a `azure.compute.Extension` has been provisioned to the virtual machine. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "example-gca", * location: "West Europe", * }); * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", { * name: "example-vnet", * location: example.location, * resourceGroupName: example.name, * addressSpaces: ["10.0.0.0/16"], * }); * const exampleSubnet = new azure.network.Subnet("example", { * name: "internal", * resourceGroupName: example.name, * virtualNetworkName: exampleVirtualNetwork.name, * addressPrefixes: ["10.0.2.0/24"], * }); * const exampleNetworkInterface = new azure.network.NetworkInterface("example", { * name: "example-nic", * resourceGroupName: example.name, * location: example.location, * ipConfigurations: [{ * name: "internal", * subnetId: exampleSubnet.id, * privateIpAddressAllocation: "Dynamic", * }], * }); * const exampleWindowsVirtualMachine = new azure.compute.WindowsVirtualMachine("example", { * name: "examplevm", * resourceGroupName: example.name, * location: example.location, * size: "Standard_F2", * adminUsername: "adminuser", * adminPassword: "P@$$w0rd1234!", * networkInterfaceIds: [exampleNetworkInterface.id], * identity: { * type: "SystemAssigned", * }, * osDisk: { * caching: "ReadWrite", * storageAccountType: "Standard_LRS", * }, * sourceImageReference: { * publisher: "MicrosoftWindowsServer", * offer: "WindowsServer", * sku: "2019-Datacenter", * version: "latest", * }, * }); * const exampleExtension = new azure.compute.Extension("example", { * name: "AzurePolicyforWindows", * virtualMachineId: exampleWindowsVirtualMachine.id, * publisher: "Microsoft.GuestConfiguration", * type: "ConfigurationforWindows", * typeHandlerVersion: "1.29", * autoUpgradeMinorVersion: true, * }); * const exampleVirtualMachineConfigurationAssignment = new azure.policy.VirtualMachineConfigurationAssignment("example", { * name: "AzureWindowsBaseline", * location: exampleWindowsVirtualMachine.location, * virtualMachineId: exampleWindowsVirtualMachine.id, * configuration: { * assignmentType: "ApplyAndMonitor", * version: "1.*", * parameters: [ * { * name: "Minimum Password Length;ExpectedValue", * value: "16", * }, * { * name: "Minimum Password Age;ExpectedValue", * value: "0", * }, * { * name: "Maximum Password Age;ExpectedValue", * value: "30,45", * }, * { * name: "Enforce Password History;ExpectedValue", * value: "10", * }, * { * name: "Password Must Meet Complexity Requirements;ExpectedValue", * value: "1", * }, * ], * }, * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Compute` - 2024-04-05 * * ## Import * * Policy Virtual Machine Configuration Assignments can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:policy/virtualMachineConfigurationAssignment:VirtualMachineConfigurationAssignment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1 * ``` */ export declare class VirtualMachineConfigurationAssignment extends pulumi.CustomResource { /** * Get an existing VirtualMachineConfigurationAssignment resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: VirtualMachineConfigurationAssignmentState, opts?: pulumi.CustomResourceOptions): VirtualMachineConfigurationAssignment; /** * Returns true if the given object is an instance of VirtualMachineConfigurationAssignment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is VirtualMachineConfigurationAssignment; /** * A `configuration` block as defined below. */ readonly configuration: pulumi.Output; /** * The Azure location where the Policy Virtual Machine Configuration Assignment should exist. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * The name of the Guest Configuration that will be assigned in this Guest Configuration Assignment. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The resource ID of the Policy Virtual Machine which this Guest Configuration Assignment should apply to. Changing this forces a new resource to be created. */ readonly virtualMachineId: pulumi.Output; /** * Create a VirtualMachineConfigurationAssignment resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: VirtualMachineConfigurationAssignmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering VirtualMachineConfigurationAssignment resources. */ export interface VirtualMachineConfigurationAssignmentState { /** * A `configuration` block as defined below. */ configuration?: pulumi.Input; /** * The Azure location where the Policy Virtual Machine Configuration Assignment should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The name of the Guest Configuration that will be assigned in this Guest Configuration Assignment. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The resource ID of the Policy Virtual Machine which this Guest Configuration Assignment should apply to. Changing this forces a new resource to be created. */ virtualMachineId?: pulumi.Input; } /** * The set of arguments for constructing a VirtualMachineConfigurationAssignment resource. */ export interface VirtualMachineConfigurationAssignmentArgs { /** * A `configuration` block as defined below. */ configuration: pulumi.Input; /** * The Azure location where the Policy Virtual Machine Configuration Assignment should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The name of the Guest Configuration that will be assigned in this Guest Configuration Assignment. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The resource ID of the Policy Virtual Machine which this Guest Configuration Assignment should apply to. Changing this forces a new resource to be created. */ virtualMachineId: pulumi.Input; }