1. Packages
  2. Azure Native
  3. API Docs
  4. sql
  5. ManagedInstanceLongTermRetentionPolicy
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi

azure-native.sql.ManagedInstanceLongTermRetentionPolicy

Explore with Pulumi AI

A long term retention policy.

Uses Azure REST API version 2023-08-01. In version 2.x of the Azure Native provider, it used API version 2022-11-01-preview.

Other available API versions: 2022-05-01-preview, 2022-08-01-preview, 2022-11-01-preview, 2023-02-01-preview, 2023-05-01-preview, 2023-08-01-preview, 2024-05-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native sql [ApiVersion]. See the version guide for details.

Example Usage

Create or update the LTR policy for the managed database.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var managedInstanceLongTermRetentionPolicy = new AzureNative.Sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicy", new()
    {
        BackupStorageAccessTier = AzureNative.Sql.BackupStorageAccessTier.Hot,
        DatabaseName = "testDatabase",
        ManagedInstanceName = "testInstance",
        MonthlyRetention = "P1Y",
        PolicyName = "default",
        ResourceGroupName = "testResourceGroup",
        WeekOfYear = 5,
        WeeklyRetention = "P1M",
        YearlyRetention = "P5Y",
    });

});
Copy
package main

import (
	sql "github.com/pulumi/pulumi-azure-native-sdk/sql/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.NewManagedInstanceLongTermRetentionPolicy(ctx, "managedInstanceLongTermRetentionPolicy", &sql.ManagedInstanceLongTermRetentionPolicyArgs{
			BackupStorageAccessTier: pulumi.String(sql.BackupStorageAccessTierHot),
			DatabaseName:            pulumi.String("testDatabase"),
			ManagedInstanceName:     pulumi.String("testInstance"),
			MonthlyRetention:        pulumi.String("P1Y"),
			PolicyName:              pulumi.String("default"),
			ResourceGroupName:       pulumi.String("testResourceGroup"),
			WeekOfYear:              pulumi.Int(5),
			WeeklyRetention:         pulumi.String("P1M"),
			YearlyRetention:         pulumi.String("P5Y"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.sql.ManagedInstanceLongTermRetentionPolicy;
import com.pulumi.azurenative.sql.ManagedInstanceLongTermRetentionPolicyArgs;
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) {
        var managedInstanceLongTermRetentionPolicy = new ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicy", ManagedInstanceLongTermRetentionPolicyArgs.builder()
            .backupStorageAccessTier("Hot")
            .databaseName("testDatabase")
            .managedInstanceName("testInstance")
            .monthlyRetention("P1Y")
            .policyName("default")
            .resourceGroupName("testResourceGroup")
            .weekOfYear(5)
            .weeklyRetention("P1M")
            .yearlyRetention("P5Y")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const managedInstanceLongTermRetentionPolicy = new azure_native.sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicy", {
    backupStorageAccessTier: azure_native.sql.BackupStorageAccessTier.Hot,
    databaseName: "testDatabase",
    managedInstanceName: "testInstance",
    monthlyRetention: "P1Y",
    policyName: "default",
    resourceGroupName: "testResourceGroup",
    weekOfYear: 5,
    weeklyRetention: "P1M",
    yearlyRetention: "P5Y",
});
Copy
import pulumi
import pulumi_azure_native as azure_native

managed_instance_long_term_retention_policy = azure_native.sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicy",
    backup_storage_access_tier=azure_native.sql.BackupStorageAccessTier.HOT,
    database_name="testDatabase",
    managed_instance_name="testInstance",
    monthly_retention="P1Y",
    policy_name="default",
    resource_group_name="testResourceGroup",
    week_of_year=5,
    weekly_retention="P1M",
    yearly_retention="P5Y")
Copy
resources:
  managedInstanceLongTermRetentionPolicy:
    type: azure-native:sql:ManagedInstanceLongTermRetentionPolicy
    properties:
      backupStorageAccessTier: Hot
      databaseName: testDatabase
      managedInstanceName: testInstance
      monthlyRetention: P1Y
      policyName: default
      resourceGroupName: testResourceGroup
      weekOfYear: 5
      weeklyRetention: P1M
      yearlyRetention: P5Y
Copy

Create ManagedInstanceLongTermRetentionPolicy Resource

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

Constructor syntax

new ManagedInstanceLongTermRetentionPolicy(name: string, args: ManagedInstanceLongTermRetentionPolicyArgs, opts?: CustomResourceOptions);
@overload
def ManagedInstanceLongTermRetentionPolicy(resource_name: str,
                                           args: ManagedInstanceLongTermRetentionPolicyArgs,
                                           opts: Optional[ResourceOptions] = None)

@overload
def ManagedInstanceLongTermRetentionPolicy(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           database_name: Optional[str] = None,
                                           managed_instance_name: Optional[str] = None,
                                           resource_group_name: Optional[str] = None,
                                           backup_storage_access_tier: Optional[Union[str, BackupStorageAccessTier]] = None,
                                           monthly_retention: Optional[str] = None,
                                           policy_name: Optional[str] = None,
                                           week_of_year: Optional[int] = None,
                                           weekly_retention: Optional[str] = None,
                                           yearly_retention: Optional[str] = None)
func NewManagedInstanceLongTermRetentionPolicy(ctx *Context, name string, args ManagedInstanceLongTermRetentionPolicyArgs, opts ...ResourceOption) (*ManagedInstanceLongTermRetentionPolicy, error)
public ManagedInstanceLongTermRetentionPolicy(string name, ManagedInstanceLongTermRetentionPolicyArgs args, CustomResourceOptions? opts = null)
public ManagedInstanceLongTermRetentionPolicy(String name, ManagedInstanceLongTermRetentionPolicyArgs args)
public ManagedInstanceLongTermRetentionPolicy(String name, ManagedInstanceLongTermRetentionPolicyArgs args, CustomResourceOptions options)
type: azure-native:sql:ManagedInstanceLongTermRetentionPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceLongTermRetentionPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ManagedInstanceLongTermRetentionPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceLongTermRetentionPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceLongTermRetentionPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ManagedInstanceLongTermRetentionPolicyArgs
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 managedInstanceLongTermRetentionPolicyResource = new AzureNative.Sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicyResource", new()
{
    DatabaseName = "string",
    ManagedInstanceName = "string",
    ResourceGroupName = "string",
    BackupStorageAccessTier = "string",
    MonthlyRetention = "string",
    PolicyName = "string",
    WeekOfYear = 0,
    WeeklyRetention = "string",
    YearlyRetention = "string",
});
Copy
example, err := sql.NewManagedInstanceLongTermRetentionPolicy(ctx, "managedInstanceLongTermRetentionPolicyResource", &sql.ManagedInstanceLongTermRetentionPolicyArgs{
	DatabaseName:            pulumi.String("string"),
	ManagedInstanceName:     pulumi.String("string"),
	ResourceGroupName:       pulumi.String("string"),
	BackupStorageAccessTier: pulumi.String("string"),
	MonthlyRetention:        pulumi.String("string"),
	PolicyName:              pulumi.String("string"),
	WeekOfYear:              pulumi.Int(0),
	WeeklyRetention:         pulumi.String("string"),
	YearlyRetention:         pulumi.String("string"),
})
Copy
var managedInstanceLongTermRetentionPolicyResource = new ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicyResource", ManagedInstanceLongTermRetentionPolicyArgs.builder()
    .databaseName("string")
    .managedInstanceName("string")
    .resourceGroupName("string")
    .backupStorageAccessTier("string")
    .monthlyRetention("string")
    .policyName("string")
    .weekOfYear(0)
    .weeklyRetention("string")
    .yearlyRetention("string")
    .build());
Copy
managed_instance_long_term_retention_policy_resource = azure_native.sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicyResource",
    database_name="string",
    managed_instance_name="string",
    resource_group_name="string",
    backup_storage_access_tier="string",
    monthly_retention="string",
    policy_name="string",
    week_of_year=0,
    weekly_retention="string",
    yearly_retention="string")
Copy
const managedInstanceLongTermRetentionPolicyResource = new azure_native.sql.ManagedInstanceLongTermRetentionPolicy("managedInstanceLongTermRetentionPolicyResource", {
    databaseName: "string",
    managedInstanceName: "string",
    resourceGroupName: "string",
    backupStorageAccessTier: "string",
    monthlyRetention: "string",
    policyName: "string",
    weekOfYear: 0,
    weeklyRetention: "string",
    yearlyRetention: "string",
});
Copy
type: azure-native:sql:ManagedInstanceLongTermRetentionPolicy
properties:
    backupStorageAccessTier: string
    databaseName: string
    managedInstanceName: string
    monthlyRetention: string
    policyName: string
    resourceGroupName: string
    weekOfYear: 0
    weeklyRetention: string
    yearlyRetention: string
Copy

ManagedInstanceLongTermRetentionPolicy 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 ManagedInstanceLongTermRetentionPolicy resource accepts the following input properties:

DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
ManagedInstanceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the managed instance.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
BackupStorageAccessTier string | Pulumi.AzureNative.Sql.BackupStorageAccessTier
The BackupStorageAccessTier for the LTR backups
MonthlyRetention string
The monthly retention policy for an LTR backup in an ISO 8601 format.
PolicyName Changes to this property will trigger replacement. string
The policy name. Should always be Default.
WeekOfYear int
The week of year to take the yearly backup in an ISO 8601 format.
WeeklyRetention string
The weekly retention policy for an LTR backup in an ISO 8601 format.
YearlyRetention string
The yearly retention policy for an LTR backup in an ISO 8601 format.
DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
ManagedInstanceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the managed instance.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
BackupStorageAccessTier string | BackupStorageAccessTier
The BackupStorageAccessTier for the LTR backups
MonthlyRetention string
The monthly retention policy for an LTR backup in an ISO 8601 format.
PolicyName Changes to this property will trigger replacement. string
The policy name. Should always be Default.
WeekOfYear int
The week of year to take the yearly backup in an ISO 8601 format.
WeeklyRetention string
The weekly retention policy for an LTR backup in an ISO 8601 format.
YearlyRetention string
The yearly retention policy for an LTR backup in an ISO 8601 format.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database.
managedInstanceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the managed instance.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
backupStorageAccessTier String | BackupStorageAccessTier
The BackupStorageAccessTier for the LTR backups
monthlyRetention String
The monthly retention policy for an LTR backup in an ISO 8601 format.
policyName Changes to this property will trigger replacement. String
The policy name. Should always be Default.
weekOfYear Integer
The week of year to take the yearly backup in an ISO 8601 format.
weeklyRetention String
The weekly retention policy for an LTR backup in an ISO 8601 format.
yearlyRetention String
The yearly retention policy for an LTR backup in an ISO 8601 format.
databaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
managedInstanceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the managed instance.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
backupStorageAccessTier string | BackupStorageAccessTier
The BackupStorageAccessTier for the LTR backups
monthlyRetention string
The monthly retention policy for an LTR backup in an ISO 8601 format.
policyName Changes to this property will trigger replacement. string
The policy name. Should always be Default.
weekOfYear number
The week of year to take the yearly backup in an ISO 8601 format.
weeklyRetention string
The weekly retention policy for an LTR backup in an ISO 8601 format.
yearlyRetention string
The yearly retention policy for an LTR backup in an ISO 8601 format.
database_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the database.
managed_instance_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the managed instance.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
backup_storage_access_tier str | BackupStorageAccessTier
The BackupStorageAccessTier for the LTR backups
monthly_retention str
The monthly retention policy for an LTR backup in an ISO 8601 format.
policy_name Changes to this property will trigger replacement. str
The policy name. Should always be Default.
week_of_year int
The week of year to take the yearly backup in an ISO 8601 format.
weekly_retention str
The weekly retention policy for an LTR backup in an ISO 8601 format.
yearly_retention str
The yearly retention policy for an LTR backup in an ISO 8601 format.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database.
managedInstanceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the managed instance.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
backupStorageAccessTier String | "Hot" | "Archive"
The BackupStorageAccessTier for the LTR backups
monthlyRetention String
The monthly retention policy for an LTR backup in an ISO 8601 format.
policyName Changes to this property will trigger replacement. String
The policy name. Should always be Default.
weekOfYear Number
The week of year to take the yearly backup in an ISO 8601 format.
weeklyRetention String
The weekly retention policy for an LTR backup in an ISO 8601 format.
yearlyRetention String
The yearly retention policy for an LTR backup in an ISO 8601 format.

Outputs

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

AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Resource name.
Type string
Resource type.
AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Resource name.
Type string
Resource type.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
name String
Resource name.
type String
Resource type.
azureApiVersion string
The Azure API version of the resource.
id string
The provider-assigned unique ID for this managed resource.
name string
Resource name.
type string
Resource type.
azure_api_version str
The Azure API version of the resource.
id str
The provider-assigned unique ID for this managed resource.
name str
Resource name.
type str
Resource type.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
name String
Resource name.
type String
Resource type.

Supporting Types

BackupStorageAccessTier
, BackupStorageAccessTierArgs

Hot
Hot
Archive
Archive
BackupStorageAccessTierHot
Hot
BackupStorageAccessTierArchive
Archive
Hot
Hot
Archive
Archive
Hot
Hot
Archive
Archive
HOT
Hot
ARCHIVE
Archive
"Hot"
Hot
"Archive"
Archive

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:sql:ManagedInstanceLongTermRetentionPolicy default /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} 
Copy

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

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0