Skip to main content

long_term_retention_policies

Creates, updates, deletes, gets or lists a long_term_retention_policies resource.

Overview

Namelong_term_retention_policies
TypeResource
Idazure.sql.long_term_retention_policies

Fields

NameDatatypeDescription
backup_storage_access_tiertextfield from the properties object
databaseNametextfield from the properties object
make_backups_immutabletextfield from the properties object
monthly_retentiontextfield from the properties object
policyNametextfield from the properties object
resourceGroupNametextfield from the properties object
serverNametextfield from the properties object
subscriptionIdtextfield from the properties object
week_of_yeartextfield from the properties object
weekly_retentiontextfield from the properties object
yearly_retentiontextfield from the properties object

Methods

NameAccessible byRequired ParamsDescription
getSELECTdatabaseName, policyName, resourceGroupName, serverName, subscriptionIdGets a database's long term retention policy.
list_by_databaseSELECTdatabaseName, resourceGroupName, serverName, subscriptionIdGets a database's long term retention policy.
create_or_updateINSERTdatabaseName, policyName, resourceGroupName, serverName, subscriptionIdSet or update a database's long term retention policy.

SELECT examples

Gets a database's long term retention policy.

SELECT
backup_storage_access_tier,
databaseName,
make_backups_immutable,
monthly_retention,
policyName,
resourceGroupName,
serverName,
subscriptionId,
week_of_year,
weekly_retention,
yearly_retention
FROM azure.sql.vw_long_term_retention_policies
WHERE databaseName = '{{ databaseName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND serverName = '{{ serverName }}'
AND subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new long_term_retention_policies resource.

/*+ create */
INSERT INTO azure.sql.long_term_retention_policies (
databaseName,
policyName,
resourceGroupName,
serverName,
subscriptionId,
properties
)
SELECT
'{{ databaseName }}',
'{{ policyName }}',
'{{ resourceGroupName }}',
'{{ serverName }}',
'{{ subscriptionId }}',
'{{ properties }}'
;