Skip to main content

managed_instance_long_term_retention_policies

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

Overview

Namemanaged_instance_long_term_retention_policies
TypeResource
Idazure.sql.managed_instance_long_term_retention_policies

Fields

NameDatatypeDescription
databaseNametextfield from the properties object
managedInstanceNametextfield from the properties object
monthly_retentiontextfield from the properties object
policyNametextfield from the properties object
resourceGroupNametextfield 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, managedInstanceName, policyName, resourceGroupName, subscriptionIdGets a managed database's long term retention policy.
list_by_databaseSELECTdatabaseName, managedInstanceName, resourceGroupName, subscriptionIdGets a database's long term retention policy.
create_or_updateINSERTdatabaseName, managedInstanceName, policyName, resourceGroupName, subscriptionIdSets a managed database's long term retention policy.

SELECT examples

Gets a database's long term retention policy.

SELECT
databaseName,
managedInstanceName,
monthly_retention,
policyName,
resourceGroupName,
subscriptionId,
week_of_year,
weekly_retention,
yearly_retention
FROM azure.sql.vw_managed_instance_long_term_retention_policies
WHERE databaseName = '{{ databaseName }}'
AND managedInstanceName = '{{ managedInstanceName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}';

INSERT example

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

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