0

I am currently working on automating the setting of retention policies of databases within an Azure managed instance. At the moment I am using the Azure Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy PowerShell Cmdlet. It would be preferable to use REST API for my automation workflow, is there an equivalent?

The retention policy is not part of the Managed Instanced - Update API. There is an equivalent API for single instance databases.

Any help in pointing me to an API would be appreciated.

Wes Toleman
  • 311
  • 5
  • 12

1 Answers1

0

this would be the api call:

/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Sql/managedInstances/zzz/databases/uuu/backupShortTermRetentionPolicies/default?api-version=2017-03-01-preview

somehow I dont see this in the API reference. But you can always do something like this to figure it out:

Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourcegroup01 -InstanceName server01 -DatabaseName database01 -RetentionDays 35 -Debug

and just at the debug output, it will contain REST call url

4c74356b41
  • 69,186
  • 6
  • 100
  • 141