Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.13k stars 3.77k forks source link

Restore-AzCosmosDBAccount cannot restore from deleted CosmosDB Account anymore #25130

Open AvevaHRM opened 1 month ago

AvevaHRM commented 1 month ago

Description

In the version Az.CosmosDB 1.10.0 or above the Restore-AzCosmosDBAccount does not allow restore from deleted CosmosDB Accounts (except the oldest one). There is a warning "No database accounts found with matching account name cosmos-aa-bb-cc that was alive at given utc-timestamp". In version 1.9.0 it works with no issue. In both cases Get-AzCosmosDBRestorableDatabaseAccount displays the current and also all the deleted CosmosDB Accounts. It has been tested with multiple CosmosDB Accounts.

Id                        : /subscriptions/xx/providers/Microsoft.DocumentDB/locations/centralus/restorableDatabaseAccounts/xx
DatabaseAccountInstanceId : xxx
Location                  : Central US
DatabaseAccountName       : cosmos-aa-bb-cc
CreationTime              : 5/14/2024 8:20:15 AM
DeletionTime              : 5/15/2024 4:24:02 PM
OldestRestorableTime      : 4/15/2024 5:10:32 PM
ApiType                   : Sql
RestorableLocations       : {Central US}

Starting restore process for cosmos-aa-gl-bb...
Initiating restore operation for CosmosDB Account 'cosmos-aa-bb-cc'...
WARNING: No database accounts found with matching account name cosmos-aa-bb-cc that was alive at given utc-timestamp 5/15/2024 12:40:34 PM in location Central US

Issue script & Debug output

$RestoredDatabaseAccount = Restore-AzCosmosDBAccount `
  -TargetResourceGroupName $ResourceGroupName `
  -TargetDatabaseAccountName $DatabaseAccountName `
  -SourceDatabaseAccountName $DatabaseAccountName `
  -RestoreTimestampInUtc $RestorePoint `
  -Location $RestorableDatabaseAccount.Location `

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     3.0.0                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     1.14.3                Az.CosmosDB                         {Get-AzCosmosDBAccount, Get-AzCosmosDBAccountKey, Get-AzCosmosDBCassandraKeyspace, Get-AzCosmosDBCassandraKeyspaceThroughput…}

Error output

WARNING: No database accounts found with matching account name cosmos-aa-bb-cc that was alive at given utc-timestamp 5/15/2024 12:40:34 PM in location Central US
Restoration failed
microsoft-github-policy-service[bot] commented 3 weeks ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pjohari-ms, @kushagraThapar, @simplynaveen20.