1. Packages
  2. Azure Native
  3. API Docs
  4. sql
  5. BackupShortTermRetentionPolicy
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.BackupShortTermRetentionPolicy

Explore with Pulumi AI

A short term retention policy.

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

Other available API versions: 2017-10-01-preview, 2020-02-02-preview, 2020-08-01-preview, 2020-11-01-preview, 2021-02-01-preview, 2021-05-01-preview, 2021-08-01-preview, 2021-11-01, 2021-11-01-preview, 2022-02-01-preview, 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

Update the short term retention policy for the database.

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

return await Deployment.RunAsync(() => 
{
    var backupShortTermRetentionPolicy = new AzureNative.Sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicy", new()
    {
        DatabaseName = "testdb",
        DiffBackupIntervalInHours = 24,
        PolicyName = "default",
        ResourceGroupName = "resourceGroup",
        RetentionDays = 7,
        ServerName = "testsvr",
    });

});
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.NewBackupShortTermRetentionPolicy(ctx, "backupShortTermRetentionPolicy", &sql.BackupShortTermRetentionPolicyArgs{
			DatabaseName:              pulumi.String("testdb"),
			DiffBackupIntervalInHours: pulumi.Int(24),
			PolicyName:                pulumi.String("default"),
			ResourceGroupName:         pulumi.String("resourceGroup"),
			RetentionDays:             pulumi.Int(7),
			ServerName:                pulumi.String("testsvr"),
		})
		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.BackupShortTermRetentionPolicy;
import com.pulumi.azurenative.sql.BackupShortTermRetentionPolicyArgs;
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 backupShortTermRetentionPolicy = new BackupShortTermRetentionPolicy("backupShortTermRetentionPolicy", BackupShortTermRetentionPolicyArgs.builder()
            .databaseName("testdb")
            .diffBackupIntervalInHours(24)
            .policyName("default")
            .resourceGroupName("resourceGroup")
            .retentionDays(7)
            .serverName("testsvr")
            .build());

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

const backupShortTermRetentionPolicy = new azure_native.sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicy", {
    databaseName: "testdb",
    diffBackupIntervalInHours: 24,
    policyName: "default",
    resourceGroupName: "resourceGroup",
    retentionDays: 7,
    serverName: "testsvr",
});
Copy
import pulumi
import pulumi_azure_native as azure_native

backup_short_term_retention_policy = azure_native.sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicy",
    database_name="testdb",
    diff_backup_interval_in_hours=24,
    policy_name="default",
    resource_group_name="resourceGroup",
    retention_days=7,
    server_name="testsvr")
Copy
resources:
  backupShortTermRetentionPolicy:
    type: azure-native:sql:BackupShortTermRetentionPolicy
    properties:
      databaseName: testdb
      diffBackupIntervalInHours: 24
      policyName: default
      resourceGroupName: resourceGroup
      retentionDays: 7
      serverName: testsvr
Copy

Create BackupShortTermRetentionPolicy Resource

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

Constructor syntax

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

@overload
def BackupShortTermRetentionPolicy(resource_name: str,
                                   opts: Optional[ResourceOptions] = None,
                                   database_name: Optional[str] = None,
                                   resource_group_name: Optional[str] = None,
                                   server_name: Optional[str] = None,
                                   diff_backup_interval_in_hours: Optional[int] = None,
                                   policy_name: Optional[str] = None,
                                   retention_days: Optional[int] = None)
func NewBackupShortTermRetentionPolicy(ctx *Context, name string, args BackupShortTermRetentionPolicyArgs, opts ...ResourceOption) (*BackupShortTermRetentionPolicy, error)
public BackupShortTermRetentionPolicy(string name, BackupShortTermRetentionPolicyArgs args, CustomResourceOptions? opts = null)
public BackupShortTermRetentionPolicy(String name, BackupShortTermRetentionPolicyArgs args)
public BackupShortTermRetentionPolicy(String name, BackupShortTermRetentionPolicyArgs args, CustomResourceOptions options)
type: azure-native:sql:BackupShortTermRetentionPolicy
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. BackupShortTermRetentionPolicyArgs
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. BackupShortTermRetentionPolicyArgs
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. BackupShortTermRetentionPolicyArgs
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. BackupShortTermRetentionPolicyArgs
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. BackupShortTermRetentionPolicyArgs
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 backupShortTermRetentionPolicyResource = new AzureNative.Sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicyResource", new()
{
    DatabaseName = "string",
    ResourceGroupName = "string",
    ServerName = "string",
    DiffBackupIntervalInHours = 0,
    PolicyName = "string",
    RetentionDays = 0,
});
Copy
example, err := sql.NewBackupShortTermRetentionPolicy(ctx, "backupShortTermRetentionPolicyResource", &sql.BackupShortTermRetentionPolicyArgs{
	DatabaseName:              pulumi.String("string"),
	ResourceGroupName:         pulumi.String("string"),
	ServerName:                pulumi.String("string"),
	DiffBackupIntervalInHours: pulumi.Int(0),
	PolicyName:                pulumi.String("string"),
	RetentionDays:             pulumi.Int(0),
})
Copy
var backupShortTermRetentionPolicyResource = new BackupShortTermRetentionPolicy("backupShortTermRetentionPolicyResource", BackupShortTermRetentionPolicyArgs.builder()
    .databaseName("string")
    .resourceGroupName("string")
    .serverName("string")
    .diffBackupIntervalInHours(0)
    .policyName("string")
    .retentionDays(0)
    .build());
Copy
backup_short_term_retention_policy_resource = azure_native.sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicyResource",
    database_name="string",
    resource_group_name="string",
    server_name="string",
    diff_backup_interval_in_hours=0,
    policy_name="string",
    retention_days=0)
Copy
const backupShortTermRetentionPolicyResource = new azure_native.sql.BackupShortTermRetentionPolicy("backupShortTermRetentionPolicyResource", {
    databaseName: "string",
    resourceGroupName: "string",
    serverName: "string",
    diffBackupIntervalInHours: 0,
    policyName: "string",
    retentionDays: 0,
});
Copy
type: azure-native:sql:BackupShortTermRetentionPolicy
properties:
    databaseName: string
    diffBackupIntervalInHours: 0
    policyName: string
    resourceGroupName: string
    retentionDays: 0
    serverName: string
Copy

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

DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
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.
ServerName
This property is required.
Changes to this property will trigger replacement.
string
The name of the server.
DiffBackupIntervalInHours int
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
PolicyName Changes to this property will trigger replacement. string
The policy name. Should always be "default".
RetentionDays int
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
DatabaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
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.
ServerName
This property is required.
Changes to this property will trigger replacement.
string
The name of the server.
DiffBackupIntervalInHours int
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
PolicyName Changes to this property will trigger replacement. string
The policy name. Should always be "default".
RetentionDays int
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database.
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.
serverName
This property is required.
Changes to this property will trigger replacement.
String
The name of the server.
diffBackupIntervalInHours Integer
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
policyName Changes to this property will trigger replacement. String
The policy name. Should always be "default".
retentionDays Integer
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
databaseName
This property is required.
Changes to this property will trigger replacement.
string
The name of the database.
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.
serverName
This property is required.
Changes to this property will trigger replacement.
string
The name of the server.
diffBackupIntervalInHours number
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
policyName Changes to this property will trigger replacement. string
The policy name. Should always be "default".
retentionDays number
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
database_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the database.
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.
server_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the server.
diff_backup_interval_in_hours int
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
policy_name Changes to this property will trigger replacement. str
The policy name. Should always be "default".
retention_days int
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
databaseName
This property is required.
Changes to this property will trigger replacement.
String
The name of the database.
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.
serverName
This property is required.
Changes to this property will trigger replacement.
String
The name of the server.
diffBackupIntervalInHours Number
The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. This is only applicable to live databases but not dropped databases.
policyName Changes to this property will trigger replacement. String
The policy name. Should always be "default".
retentionDays Number
The backup retention period in days. This is how many days Point-in-Time Restore will be supported.

Outputs

All input properties are implicitly available as output properties. Additionally, the BackupShortTermRetentionPolicy 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.

Import

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

$ pulumi import azure-native:sql:BackupShortTermRetentionPolicy default /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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