We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.policy.getVirtualMachineConfigurationAssignment
Explore with Pulumi AI
Use this data source to access information about an existing Guest Configuration Policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.policy.getVirtualMachineConfigurationAssignment({
    name: "AzureWindowsBaseline",
    resourceGroupName: "example-RG",
    virtualMachineName: "example-vm",
});
export const complianceStatus = example.then(example => example.complianceStatus);
import pulumi
import pulumi_azure as azure
example = azure.policy.get_virtual_machine_configuration_assignment(name="AzureWindowsBaseline",
    resource_group_name="example-RG",
    virtual_machine_name="example-vm")
pulumi.export("complianceStatus", example.compliance_status)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/policy"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := policy.LookupVirtualMachineConfigurationAssignment(ctx, &policy.LookupVirtualMachineConfigurationAssignmentArgs{
			Name:               "AzureWindowsBaseline",
			ResourceGroupName:  "example-RG",
			VirtualMachineName: "example-vm",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("complianceStatus", example.ComplianceStatus)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.Policy.GetVirtualMachineConfigurationAssignment.Invoke(new()
    {
        Name = "AzureWindowsBaseline",
        ResourceGroupName = "example-RG",
        VirtualMachineName = "example-vm",
    });
    return new Dictionary<string, object?>
    {
        ["complianceStatus"] = example.Apply(getVirtualMachineConfigurationAssignmentResult => getVirtualMachineConfigurationAssignmentResult.ComplianceStatus),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.policy.PolicyFunctions;
import com.pulumi.azure.policy.inputs.GetVirtualMachineConfigurationAssignmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = PolicyFunctions.getVirtualMachineConfigurationAssignment(GetVirtualMachineConfigurationAssignmentArgs.builder()
            .name("AzureWindowsBaseline")
            .resourceGroupName("example-RG")
            .virtualMachineName("example-vm")
            .build());
        ctx.export("complianceStatus", example.applyValue(getVirtualMachineConfigurationAssignmentResult -> getVirtualMachineConfigurationAssignmentResult.complianceStatus()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:policy:getVirtualMachineConfigurationAssignment
      arguments:
        name: AzureWindowsBaseline
        resourceGroupName: example-RG
        virtualMachineName: example-vm
outputs:
  complianceStatus: ${example.complianceStatus}
Using getVirtualMachineConfigurationAssignment
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVirtualMachineConfigurationAssignment(args: GetVirtualMachineConfigurationAssignmentArgs, opts?: InvokeOptions): Promise<GetVirtualMachineConfigurationAssignmentResult>
function getVirtualMachineConfigurationAssignmentOutput(args: GetVirtualMachineConfigurationAssignmentOutputArgs, opts?: InvokeOptions): Output<GetVirtualMachineConfigurationAssignmentResult>def get_virtual_machine_configuration_assignment(name: Optional[str] = None,
                                                 resource_group_name: Optional[str] = None,
                                                 virtual_machine_name: Optional[str] = None,
                                                 opts: Optional[InvokeOptions] = None) -> GetVirtualMachineConfigurationAssignmentResult
def get_virtual_machine_configuration_assignment_output(name: Optional[pulumi.Input[str]] = None,
                                                 resource_group_name: Optional[pulumi.Input[str]] = None,
                                                 virtual_machine_name: Optional[pulumi.Input[str]] = None,
                                                 opts: Optional[InvokeOptions] = None) -> Output[GetVirtualMachineConfigurationAssignmentResult]func LookupVirtualMachineConfigurationAssignment(ctx *Context, args *LookupVirtualMachineConfigurationAssignmentArgs, opts ...InvokeOption) (*LookupVirtualMachineConfigurationAssignmentResult, error)
func LookupVirtualMachineConfigurationAssignmentOutput(ctx *Context, args *LookupVirtualMachineConfigurationAssignmentOutputArgs, opts ...InvokeOption) LookupVirtualMachineConfigurationAssignmentResultOutput> Note: This function is named LookupVirtualMachineConfigurationAssignment in the Go SDK.
public static class GetVirtualMachineConfigurationAssignment 
{
    public static Task<GetVirtualMachineConfigurationAssignmentResult> InvokeAsync(GetVirtualMachineConfigurationAssignmentArgs args, InvokeOptions? opts = null)
    public static Output<GetVirtualMachineConfigurationAssignmentResult> Invoke(GetVirtualMachineConfigurationAssignmentInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVirtualMachineConfigurationAssignmentResult> getVirtualMachineConfigurationAssignment(GetVirtualMachineConfigurationAssignmentArgs args, InvokeOptions options)
public static Output<GetVirtualMachineConfigurationAssignmentResult> getVirtualMachineConfigurationAssignment(GetVirtualMachineConfigurationAssignmentArgs args, InvokeOptions options)
fn::invoke:
  function: azure:policy/getVirtualMachineConfigurationAssignment:getVirtualMachineConfigurationAssignment
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name string
- Specifies the name of the Guest Configuration Assignment.
- ResourceGroup stringName 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- VirtualMachine stringName 
- Only retrieve Policy Set Definitions from this Management Group.
- Name string
- Specifies the name of the Guest Configuration Assignment.
- ResourceGroup stringName 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- VirtualMachine stringName 
- Only retrieve Policy Set Definitions from this Management Group.
- name String
- Specifies the name of the Guest Configuration Assignment.
- resourceGroup StringName 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- virtualMachine StringName 
- Only retrieve Policy Set Definitions from this Management Group.
- name string
- Specifies the name of the Guest Configuration Assignment.
- resourceGroup stringName 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- virtualMachine stringName 
- Only retrieve Policy Set Definitions from this Management Group.
- name str
- Specifies the name of the Guest Configuration Assignment.
- resource_group_ strname 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- virtual_machine_ strname 
- Only retrieve Policy Set Definitions from this Management Group.
- name String
- Specifies the name of the Guest Configuration Assignment.
- resourceGroup StringName 
- Specifies the Name of the Resource Group where the Guest Configuration Assignment exists.
- virtualMachine StringName 
- Only retrieve Policy Set Definitions from this Management Group.
getVirtualMachineConfigurationAssignment Result
The following output properties are available:
- AssignmentHash string
- Combined hash of the configuration package and parameters.
- ComplianceStatus string
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- ContentHash string
- The content hash for the Guest Configuration package.
- ContentUri string
- The content URI where the Guest Configuration package is stored.
- Id string
- The provider-assigned unique ID for this managed resource.
- LastCompliance stringStatus Checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- LatestReport stringId 
- The ID of the latest report for the guest configuration assignment.
- Name string
- ResourceGroup stringName 
- VirtualMachine stringName 
- AssignmentHash string
- Combined hash of the configuration package and parameters.
- ComplianceStatus string
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- ContentHash string
- The content hash for the Guest Configuration package.
- ContentUri string
- The content URI where the Guest Configuration package is stored.
- Id string
- The provider-assigned unique ID for this managed resource.
- LastCompliance stringStatus Checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- LatestReport stringId 
- The ID of the latest report for the guest configuration assignment.
- Name string
- ResourceGroup stringName 
- VirtualMachine stringName 
- assignmentHash String
- Combined hash of the configuration package and parameters.
- complianceStatus String
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- contentHash String
- The content hash for the Guest Configuration package.
- contentUri String
- The content URI where the Guest Configuration package is stored.
- id String
- The provider-assigned unique ID for this managed resource.
- lastCompliance StringStatus Checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- latestReport StringId 
- The ID of the latest report for the guest configuration assignment.
- name String
- resourceGroup StringName 
- virtualMachine StringName 
- assignmentHash string
- Combined hash of the configuration package and parameters.
- complianceStatus string
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- contentHash string
- The content hash for the Guest Configuration package.
- contentUri string
- The content URI where the Guest Configuration package is stored.
- id string
- The provider-assigned unique ID for this managed resource.
- lastCompliance stringStatus Checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- latestReport stringId 
- The ID of the latest report for the guest configuration assignment.
- name string
- resourceGroup stringName 
- virtualMachine stringName 
- assignment_hash str
- Combined hash of the configuration package and parameters.
- compliance_status str
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- content_hash str
- The content hash for the Guest Configuration package.
- content_uri str
- The content URI where the Guest Configuration package is stored.
- id str
- The provider-assigned unique ID for this managed resource.
- last_compliance_ strstatus_ checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- latest_report_ strid 
- The ID of the latest report for the guest configuration assignment.
- name str
- resource_group_ strname 
- virtual_machine_ strname 
- assignmentHash String
- Combined hash of the configuration package and parameters.
- complianceStatus String
- A value indicating compliance status of the machine for the assigned guest configuration. Possible return values are Compliant,NonCompliantandPending.
- contentHash String
- The content hash for the Guest Configuration package.
- contentUri String
- The content URI where the Guest Configuration package is stored.
- id String
- The provider-assigned unique ID for this managed resource.
- lastCompliance StringStatus Checked 
- Date and time, in RFC3339 format, when the machines compliance status was last checked.
- latestReport StringId 
- The ID of the latest report for the guest configuration assignment.
- name String
- resourceGroup StringName 
- virtualMachine StringName 
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.