Search code examples
azure-sql-managed-instancepowershell-az-module

ServerName for Get-AzSqlDatabaseLongTermRetentionPolicy and Set-AzSqlDatabaseLongTermRetentionPolicy with Azure Managed Instance


I am trying to set LTR on databases in our Managed Instances via the above listed Az commandlets. The problem I am having is determining what the ServerName parameter should be. If I try to use the ManagedInstanceName or FullyQualifiedManagedInstanceName it gives me the following error:

"Can not perform requested operation on nested resource. Parent resource '[instnaceName]/[databaseName]'"

What should I use for this parameter?


Solution

  • The problem was that I was using the wrong commandlet. The correct commandlet for Managed Instances is Get-AzSqlInstanceDatabaseLongTermRetentionPolicy