1. Packages
  2. Azure Classic
  3. API Docs
  4. backup
  5. PolicyVM

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages an Azure Backup VM Backup Policy.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleVault = new Azure.RecoveryServices.Vault("exampleVault", new Azure.RecoveryServices.VaultArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                Sku = "Standard",
            });
            var examplePolicyVM = new Azure.Backup.PolicyVM("examplePolicyVM", new Azure.Backup.PolicyVMArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                RecoveryVaultName = exampleVault.Name,
                Timezone = "UTC",
                Backup = new Azure.Backup.Inputs.PolicyVMBackupArgs
                {
                    Frequency = "Daily",
                    Time = "23:00",
                },
                RetentionDaily = new Azure.Backup.Inputs.PolicyVMRetentionDailyArgs
                {
                    Count = 10,
                },
                RetentionWeekly = new Azure.Backup.Inputs.PolicyVMRetentionWeeklyArgs
                {
                    Count = 42,
                    Weekdays = 
                    {
                        "Sunday",
                        "Wednesday",
                        "Friday",
                        "Saturday",
                    },
                },
                RetentionMonthly = new Azure.Backup.Inputs.PolicyVMRetentionMonthlyArgs
                {
                    Count = 7,
                    Weekdays = 
                    {
                        "Sunday",
                        "Wednesday",
                    },
                    Weeks = 
                    {
                        "First",
                        "Last",
                    },
                },
                RetentionYearly = new Azure.Backup.Inputs.PolicyVMRetentionYearlyArgs
                {
                    Count = 77,
                    Weekdays = 
                    {
                        "Sunday",
                    },
                    Weeks = 
                    {
                        "Last",
                    },
                    Months = 
                    {
                        "January",
                    },
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/backup"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/recoveryservices"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVault, err := recoveryservices.NewVault(ctx, "exampleVault", &recoveryservices.VaultArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = backup.NewPolicyVM(ctx, "examplePolicyVM", &backup.PolicyVMArgs{
    			ResourceGroupName: exampleResourceGroup.Name,
    			RecoveryVaultName: exampleVault.Name,
    			Timezone:          pulumi.String("UTC"),
    			Backup: &backup.PolicyVMBackupArgs{
    				Frequency: pulumi.String("Daily"),
    				Time:      pulumi.String("23:00"),
    			},
    			RetentionDaily: &backup.PolicyVMRetentionDailyArgs{
    				Count: pulumi.Int(10),
    			},
    			RetentionWeekly: &backup.PolicyVMRetentionWeeklyArgs{
    				Count: pulumi.Int(42),
    				Weekdays: pulumi.StringArray{
    					pulumi.String("Sunday"),
    					pulumi.String("Wednesday"),
    					pulumi.String("Friday"),
    					pulumi.String("Saturday"),
    				},
    			},
    			RetentionMonthly: &backup.PolicyVMRetentionMonthlyArgs{
    				Count: pulumi.Int(7),
    				Weekdays: pulumi.StringArray{
    					pulumi.String("Sunday"),
    					pulumi.String("Wednesday"),
    				},
    				Weeks: pulumi.StringArray{
    					pulumi.String("First"),
    					pulumi.String("Last"),
    				},
    			},
    			RetentionYearly: &backup.PolicyVMRetentionYearlyArgs{
    				Count: pulumi.Int(77),
    				Weekdays: pulumi.StringArray{
    					pulumi.String("Sunday"),
    				},
    				Weeks: pulumi.StringArray{
    					pulumi.String("Last"),
    				},
    				Months: pulumi.StringArray{
    					pulumi.String("January"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleVault = new azure.recoveryservices.Vault("exampleVault", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        sku: "Standard",
    });
    const examplePolicyVM = new azure.backup.PolicyVM("examplePolicyVM", {
        resourceGroupName: exampleResourceGroup.name,
        recoveryVaultName: exampleVault.name,
        timezone: "UTC",
        backup: {
            frequency: "Daily",
            time: "23:00",
        },
        retentionDaily: {
            count: 10,
        },
        retentionWeekly: {
            count: 42,
            weekdays: [
                "Sunday",
                "Wednesday",
                "Friday",
                "Saturday",
            ],
        },
        retentionMonthly: {
            count: 7,
            weekdays: [
                "Sunday",
                "Wednesday",
            ],
            weeks: [
                "First",
                "Last",
            ],
        },
        retentionYearly: {
            count: 77,
            weekdays: ["Sunday"],
            weeks: ["Last"],
            months: ["January"],
        },
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_vault = azure.recoveryservices.Vault("exampleVault",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        sku="Standard")
    example_policy_vm = azure.backup.PolicyVM("examplePolicyVM",
        resource_group_name=example_resource_group.name,
        recovery_vault_name=example_vault.name,
        timezone="UTC",
        backup=azure.backup.PolicyVMBackupArgs(
            frequency="Daily",
            time="23:00",
        ),
        retention_daily=azure.backup.PolicyVMRetentionDailyArgs(
            count=10,
        ),
        retention_weekly=azure.backup.PolicyVMRetentionWeeklyArgs(
            count=42,
            weekdays=[
                "Sunday",
                "Wednesday",
                "Friday",
                "Saturday",
            ],
        ),
        retention_monthly=azure.backup.PolicyVMRetentionMonthlyArgs(
            count=7,
            weekdays=[
                "Sunday",
                "Wednesday",
            ],
            weeks=[
                "First",
                "Last",
            ],
        ),
        retention_yearly=azure.backup.PolicyVMRetentionYearlyArgs(
            count=77,
            weekdays=["Sunday"],
            weeks=["Last"],
            months=["January"],
        ))
    

    Example coming soon!

    Create PolicyVM Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new PolicyVM(name: string, args: PolicyVMArgs, opts?: CustomResourceOptions);
    @overload
    def PolicyVM(resource_name: str,
                 args: PolicyVMArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def PolicyVM(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 backup: Optional[PolicyVMBackupArgs] = None,
                 recovery_vault_name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 instant_restore_retention_days: Optional[int] = None,
                 name: Optional[str] = None,
                 retention_daily: Optional[PolicyVMRetentionDailyArgs] = None,
                 retention_monthly: Optional[PolicyVMRetentionMonthlyArgs] = None,
                 retention_weekly: Optional[PolicyVMRetentionWeeklyArgs] = None,
                 retention_yearly: Optional[PolicyVMRetentionYearlyArgs] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 timezone: Optional[str] = None)
    func NewPolicyVM(ctx *Context, name string, args PolicyVMArgs, opts ...ResourceOption) (*PolicyVM, error)
    public PolicyVM(string name, PolicyVMArgs args, CustomResourceOptions? opts = null)
    public PolicyVM(String name, PolicyVMArgs args)
    public PolicyVM(String name, PolicyVMArgs args, CustomResourceOptions options)
    
    type: azure:backup:PolicyVM
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PolicyVMArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PolicyVMArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PolicyVMArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyVMArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyVMArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var policyVMResource = new Azure.Backup.PolicyVM("policyVMResource", new()
    {
        Backup = new Azure.Backup.Inputs.PolicyVMBackupArgs
        {
            Frequency = "string",
            Time = "string",
            Weekdays = new[]
            {
                "string",
            },
        },
        RecoveryVaultName = "string",
        ResourceGroupName = "string",
        InstantRestoreRetentionDays = 0,
        Name = "string",
        RetentionDaily = new Azure.Backup.Inputs.PolicyVMRetentionDailyArgs
        {
            Count = 0,
        },
        RetentionMonthly = new Azure.Backup.Inputs.PolicyVMRetentionMonthlyArgs
        {
            Count = 0,
            Weekdays = new[]
            {
                "string",
            },
            Weeks = new[]
            {
                "string",
            },
        },
        RetentionWeekly = new Azure.Backup.Inputs.PolicyVMRetentionWeeklyArgs
        {
            Count = 0,
            Weekdays = new[]
            {
                "string",
            },
        },
        RetentionYearly = new Azure.Backup.Inputs.PolicyVMRetentionYearlyArgs
        {
            Count = 0,
            Months = new[]
            {
                "string",
            },
            Weekdays = new[]
            {
                "string",
            },
            Weeks = new[]
            {
                "string",
            },
        },
        Tags = 
        {
            { "string", "string" },
        },
        Timezone = "string",
    });
    
    example, err := backup.NewPolicyVM(ctx, "policyVMResource", &backup.PolicyVMArgs{
    	Backup: &backup.PolicyVMBackupArgs{
    		Frequency: pulumi.String("string"),
    		Time:      pulumi.String("string"),
    		Weekdays: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	RecoveryVaultName:           pulumi.String("string"),
    	ResourceGroupName:           pulumi.String("string"),
    	InstantRestoreRetentionDays: pulumi.Int(0),
    	Name:                        pulumi.String("string"),
    	RetentionDaily: &backup.PolicyVMRetentionDailyArgs{
    		Count: pulumi.Int(0),
    	},
    	RetentionMonthly: &backup.PolicyVMRetentionMonthlyArgs{
    		Count: pulumi.Int(0),
    		Weekdays: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Weeks: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	RetentionWeekly: &backup.PolicyVMRetentionWeeklyArgs{
    		Count: pulumi.Int(0),
    		Weekdays: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	RetentionYearly: &backup.PolicyVMRetentionYearlyArgs{
    		Count: pulumi.Int(0),
    		Months: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Weekdays: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Weeks: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Timezone: pulumi.String("string"),
    })
    
    var policyVMResource = new PolicyVM("policyVMResource", PolicyVMArgs.builder()
        .backup(PolicyVMBackupArgs.builder()
            .frequency("string")
            .time("string")
            .weekdays("string")
            .build())
        .recoveryVaultName("string")
        .resourceGroupName("string")
        .instantRestoreRetentionDays(0)
        .name("string")
        .retentionDaily(PolicyVMRetentionDailyArgs.builder()
            .count(0)
            .build())
        .retentionMonthly(PolicyVMRetentionMonthlyArgs.builder()
            .count(0)
            .weekdays("string")
            .weeks("string")
            .build())
        .retentionWeekly(PolicyVMRetentionWeeklyArgs.builder()
            .count(0)
            .weekdays("string")
            .build())
        .retentionYearly(PolicyVMRetentionYearlyArgs.builder()
            .count(0)
            .months("string")
            .weekdays("string")
            .weeks("string")
            .build())
        .tags(Map.of("string", "string"))
        .timezone("string")
        .build());
    
    policy_vm_resource = azure.backup.PolicyVM("policyVMResource",
        backup={
            "frequency": "string",
            "time": "string",
            "weekdays": ["string"],
        },
        recovery_vault_name="string",
        resource_group_name="string",
        instant_restore_retention_days=0,
        name="string",
        retention_daily={
            "count": 0,
        },
        retention_monthly={
            "count": 0,
            "weekdays": ["string"],
            "weeks": ["string"],
        },
        retention_weekly={
            "count": 0,
            "weekdays": ["string"],
        },
        retention_yearly={
            "count": 0,
            "months": ["string"],
            "weekdays": ["string"],
            "weeks": ["string"],
        },
        tags={
            "string": "string",
        },
        timezone="string")
    
    const policyVMResource = new azure.backup.PolicyVM("policyVMResource", {
        backup: {
            frequency: "string",
            time: "string",
            weekdays: ["string"],
        },
        recoveryVaultName: "string",
        resourceGroupName: "string",
        instantRestoreRetentionDays: 0,
        name: "string",
        retentionDaily: {
            count: 0,
        },
        retentionMonthly: {
            count: 0,
            weekdays: ["string"],
            weeks: ["string"],
        },
        retentionWeekly: {
            count: 0,
            weekdays: ["string"],
        },
        retentionYearly: {
            count: 0,
            months: ["string"],
            weekdays: ["string"],
            weeks: ["string"],
        },
        tags: {
            string: "string",
        },
        timezone: "string",
    });
    
    type: azure:backup:PolicyVM
    properties:
        backup:
            frequency: string
            time: string
            weekdays:
                - string
        instantRestoreRetentionDays: 0
        name: string
        recoveryVaultName: string
        resourceGroupName: string
        retentionDaily:
            count: 0
        retentionMonthly:
            count: 0
            weekdays:
                - string
            weeks:
                - string
        retentionWeekly:
            count: 0
            weekdays:
                - string
        retentionYearly:
            count: 0
            months:
                - string
            weekdays:
                - string
            weeks:
                - string
        tags:
            string: string
        timezone: string
    

    PolicyVM Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The PolicyVM resource accepts the following input properties:

    Backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    RecoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    InstantRestoreRetentionDays int
    Specifies the instant restore retention range in days.
    Name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    RetentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    RetentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    RetentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    RetentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    Backup PolicyVMBackupArgs
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    RecoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    InstantRestoreRetentionDays int
    Specifies the instant restore retention range in days.
    Name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    RetentionDaily PolicyVMRetentionDailyArgs
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    RetentionMonthly PolicyVMRetentionMonthlyArgs
    Configures the policy monthly retention as documented in the retention_monthly block below.
    RetentionWeekly PolicyVMRetentionWeeklyArgs
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    RetentionYearly PolicyVMRetentionYearlyArgs
    Configures the policy yearly retention as documented in the retention_yearly block below.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    Timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    recoveryVaultName String
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    instantRestoreRetentionDays Integer
    Specifies the instant restore retention range in days.
    name String
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    retentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    timezone String
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    recoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    instantRestoreRetentionDays number
    Specifies the instant restore retention range in days.
    name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    retentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackupArgs
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    recovery_vault_name str
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    instant_restore_retention_days int
    Specifies the instant restore retention range in days.
    name str
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    retention_daily PolicyVMRetentionDailyArgs
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retention_monthly PolicyVMRetentionMonthlyArgs
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retention_weekly PolicyVMRetentionWeeklyArgs
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retention_yearly PolicyVMRetentionYearlyArgs
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    timezone str
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup Property Map
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    recoveryVaultName String
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    instantRestoreRetentionDays Number
    Specifies the instant restore retention range in days.
    name String
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    retentionDaily Property Map
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly Property Map
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly Property Map
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly Property Map
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Map<String>
    A mapping of tags to assign to the resource.
    timezone String
    Specifies the timezone. the possible values are defined here. Defaults to UTC

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PolicyVM resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing PolicyVM Resource

    Get an existing PolicyVM resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: PolicyVMState, opts?: CustomResourceOptions): PolicyVM
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backup: Optional[PolicyVMBackupArgs] = None,
            instant_restore_retention_days: Optional[int] = None,
            name: Optional[str] = None,
            recovery_vault_name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            retention_daily: Optional[PolicyVMRetentionDailyArgs] = None,
            retention_monthly: Optional[PolicyVMRetentionMonthlyArgs] = None,
            retention_weekly: Optional[PolicyVMRetentionWeeklyArgs] = None,
            retention_yearly: Optional[PolicyVMRetentionYearlyArgs] = None,
            tags: Optional[Mapping[str, str]] = None,
            timezone: Optional[str] = None) -> PolicyVM
    func GetPolicyVM(ctx *Context, name string, id IDInput, state *PolicyVMState, opts ...ResourceOption) (*PolicyVM, error)
    public static PolicyVM Get(string name, Input<string> id, PolicyVMState? state, CustomResourceOptions? opts = null)
    public static PolicyVM get(String name, Output<String> id, PolicyVMState state, CustomResourceOptions options)
    resources:  _:    type: azure:backup:PolicyVM    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    InstantRestoreRetentionDays int
    Specifies the instant restore retention range in days.
    Name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    RecoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    RetentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    RetentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    RetentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    RetentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    Backup PolicyVMBackupArgs
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    InstantRestoreRetentionDays int
    Specifies the instant restore retention range in days.
    Name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    RecoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    RetentionDaily PolicyVMRetentionDailyArgs
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    RetentionMonthly PolicyVMRetentionMonthlyArgs
    Configures the policy monthly retention as documented in the retention_monthly block below.
    RetentionWeekly PolicyVMRetentionWeeklyArgs
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    RetentionYearly PolicyVMRetentionYearlyArgs
    Configures the policy yearly retention as documented in the retention_yearly block below.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    Timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    instantRestoreRetentionDays Integer
    Specifies the instant restore retention range in days.
    name String
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    recoveryVaultName String
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    retentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    timezone String
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackup
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    instantRestoreRetentionDays number
    Specifies the instant restore retention range in days.
    name string
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    recoveryVaultName string
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    retentionDaily PolicyVMRetentionDaily
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly PolicyVMRetentionMonthly
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly PolicyVMRetentionWeekly
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly PolicyVMRetentionYearly
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    timezone string
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup PolicyVMBackupArgs
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    instant_restore_retention_days int
    Specifies the instant restore retention range in days.
    name str
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    recovery_vault_name str
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    retention_daily PolicyVMRetentionDailyArgs
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retention_monthly PolicyVMRetentionMonthlyArgs
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retention_weekly PolicyVMRetentionWeeklyArgs
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retention_yearly PolicyVMRetentionYearlyArgs
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    timezone str
    Specifies the timezone. the possible values are defined here. Defaults to UTC
    backup Property Map
    Configures the Policy backup frequency, times & days as documented in the backup block below.
    instantRestoreRetentionDays Number
    Specifies the instant restore retention range in days.
    name String
    Specifies the name of the Backup Policy. Changing this forces a new resource to be created.
    recoveryVaultName String
    Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
    retentionDaily Property Map
    Configures the policy daily retention as documented in the retention_daily block below. Required when backup frequency is Daily.
    retentionMonthly Property Map
    Configures the policy monthly retention as documented in the retention_monthly block below.
    retentionWeekly Property Map
    Configures the policy weekly retention as documented in the retention_weekly block below. Required when backup frequency is Weekly.
    retentionYearly Property Map
    Configures the policy yearly retention as documented in the retention_yearly block below.
    tags Map<String>
    A mapping of tags to assign to the resource.
    timezone String
    Specifies the timezone. the possible values are defined here. Defaults to UTC

    Supporting Types

    PolicyVMBackup, PolicyVMBackupArgs

    Frequency string
    Sets the backup frequency. Must be either Daily orWeekly.
    Time string
    The time of day to perform the backup in 24hour format.
    Weekdays List<string>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Frequency string
    Sets the backup frequency. Must be either Daily orWeekly.
    Time string
    The time of day to perform the backup in 24hour format.
    Weekdays []string
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    frequency String
    Sets the backup frequency. Must be either Daily orWeekly.
    time String
    The time of day to perform the backup in 24hour format.
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    frequency string
    Sets the backup frequency. Must be either Daily orWeekly.
    time string
    The time of day to perform the backup in 24hour format.
    weekdays string[]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    frequency str
    Sets the backup frequency. Must be either Daily orWeekly.
    time str
    The time of day to perform the backup in 24hour format.
    weekdays Sequence[str]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    frequency String
    Sets the backup frequency. Must be either Daily orWeekly.
    time String
    The time of day to perform the backup in 24hour format.
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.

    PolicyVMRetentionDaily, PolicyVMRetentionDailyArgs

    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    count Integer
    The number of yearly backups to keep. Must be between 1 and 9999
    count number
    The number of yearly backups to keep. Must be between 1 and 9999
    count int
    The number of yearly backups to keep. Must be between 1 and 9999
    count Number
    The number of yearly backups to keep. Must be between 1 and 9999

    PolicyVMRetentionMonthly, PolicyVMRetentionMonthlyArgs

    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Weekdays List<string>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Weeks List<string>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Weekdays []string
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Weeks []string
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count Integer
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks List<String>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count number
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays string[]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks string[]
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count int
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays Sequence[str]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks Sequence[str]
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count Number
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks List<String>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.

    PolicyVMRetentionWeekly, PolicyVMRetentionWeeklyArgs

    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Weekdays List<string>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Weekdays []string
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    count Integer
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    count number
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays string[]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    count int
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays Sequence[str]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    count Number
    The number of yearly backups to keep. Must be between 1 and 9999
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.

    PolicyVMRetentionYearly, PolicyVMRetentionYearlyArgs

    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Months List<string>
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    Weekdays List<string>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Weeks List<string>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    Count int
    The number of yearly backups to keep. Must be between 1 and 9999
    Months []string
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    Weekdays []string
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    Weeks []string
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count Integer
    The number of yearly backups to keep. Must be between 1 and 9999
    months List<String>
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks List<String>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count number
    The number of yearly backups to keep. Must be between 1 and 9999
    months string[]
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    weekdays string[]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks string[]
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count int
    The number of yearly backups to keep. Must be between 1 and 9999
    months Sequence[str]
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    weekdays Sequence[str]
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks Sequence[str]
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.
    count Number
    The number of yearly backups to keep. Must be between 1 and 9999
    months List<String>
    The months of the year to retain backups of. Must be one of January, February, March, April, May, June, July, August, September, October, November and December.
    weekdays List<String>
    The weekday backups to retain . Must be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday.
    weeks List<String>
    The weeks of the month to retain backups of. Must be one of First, Second, Third, Fourth, Last.

    Import

    VM Backup Policies can be imported using the resource id, e.g.

     $ pulumi import azure:backup/policyVM:PolicyVM policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupPolicies/policy1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.