ProtectedVM
Manages Azure Backup for an Azure VM
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 US",
});
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,
Backup = new Azure.Backup.Inputs.PolicyVMBackupArgs
{
Frequency = "Daily",
Time = "23:00",
},
});
var vm1 = new Azure.Backup.ProtectedVM("vm1", new Azure.Backup.ProtectedVMArgs
{
ResourceGroupName = exampleResourceGroup.Name,
RecoveryVaultName = exampleVault.Name,
SourceVmId = azurerm_virtual_machine.Example.Id,
BackupPolicyId = examplePolicyVM.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/backup"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/recoveryservices"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West US"),
})
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
}
examplePolicyVM, err := backup.NewPolicyVM(ctx, "examplePolicyVM", &backup.PolicyVMArgs{
ResourceGroupName: exampleResourceGroup.Name,
RecoveryVaultName: exampleVault.Name,
Backup: &backup.PolicyVMBackupArgs{
Frequency: pulumi.String("Daily"),
Time: pulumi.String("23:00"),
},
})
if err != nil {
return err
}
_, err = backup.NewProtectedVM(ctx, "vm1", &backup.ProtectedVMArgs{
ResourceGroupName: exampleResourceGroup.Name,
RecoveryVaultName: exampleVault.Name,
SourceVmId: pulumi.String(azurerm_virtual_machine.Example.Id),
BackupPolicyId: examplePolicyVM.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
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,
backup={
"frequency": "Daily",
"time": "23:00",
})
vm1 = azure.backup.ProtectedVM("vm1",
resource_group_name=example_resource_group.name,
recovery_vault_name=example_vault.name,
source_vm_id=azurerm_virtual_machine["example"]["id"],
backup_policy_id=example_policy_vm.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West US"});
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,
backup: {
frequency: "Daily",
time: "23:00",
},
});
const vm1 = new azure.backup.ProtectedVM("vm1", {
resourceGroupName: exampleResourceGroup.name,
recoveryVaultName: exampleVault.name,
sourceVmId: azurerm_virtual_machine.example.id,
backupPolicyId: examplePolicyVM.id,
});Create a ProtectedVM Resource
new ProtectedVM(name: string, args: ProtectedVMArgs, opts?: CustomResourceOptions);def ProtectedVM(resource_name, opts=None, backup_policy_id=None, recovery_vault_name=None, resource_group_name=None, source_vm_id=None, tags=None, __props__=None);func NewProtectedVM(ctx *Context, name string, args ProtectedVMArgs, opts ...ResourceOption) (*ProtectedVM, error)public ProtectedVM(string name, ProtectedVMArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ProtectedVMArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ProtectedVMArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProtectedVMArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
ProtectedVM Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The ProtectedVM resource accepts the following input properties:
- Backup
Policy stringId Specifies the id of the backup policy to use.
- Recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- Source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Backup
Policy stringId Specifies the id of the backup policy to use.
- Recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- Source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- map[string]string
A mapping of tags to assign to the resource.
- backup
Policy stringId Specifies the id of the backup policy to use.
- recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- backup_
policy_ strid Specifies the id of the backup policy to use.
- recovery_
vault_ strname Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- source_
vm_ strid Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- Dict[str, str]
A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProtectedVM resource produces the following output properties:
Look up an Existing ProtectedVM Resource
Get an existing ProtectedVM 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?: ProtectedVMState, opts?: CustomResourceOptions): ProtectedVMstatic get(resource_name, id, opts=None, backup_policy_id=None, recovery_vault_name=None, resource_group_name=None, source_vm_id=None, tags=None, __props__=None);func GetProtectedVM(ctx *Context, name string, id IDInput, state *ProtectedVMState, opts ...ResourceOption) (*ProtectedVM, error)public static ProtectedVM Get(string name, Input<string> id, ProtectedVMState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Backup
Policy stringId Specifies the id of the backup policy to use.
- Recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- Source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Backup
Policy stringId Specifies the id of the backup policy to use.
- Recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- Source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- map[string]string
A mapping of tags to assign to the resource.
- backup
Policy stringId Specifies the id of the backup policy to use.
- recovery
Vault stringName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- source
Vm stringId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- backup_
policy_ strid Specifies the id of the backup policy to use.
- recovery_
vault_ strname Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which to create the Recovery Services Protected VM. Changing this forces a new resource to be created.
- source_
vm_ strid Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
- Dict[str, str]
A mapping of tags to assign to the resource.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.