Skip to content

az cosmosdb restore wrongfully appends location to name causing it to fail #32608

@Rick-van-Dam

Description

@Rick-van-Dam

Describe the bug

It does create the database with the name riks-models-003-acc but after a while results in this error. Apparently its appending the location westeurope to the name.

The version of the azure cli is 2.80.0

Related command

PS C:\git> az cosmosdb restore --target-database-account-name riks-models-003-acc --account-name riks-models-003-acc --assign-identity /subscriptions/2e9be2d7-cd16-4654-b3d6-9531fa26392e/resourceGroups/rg-models-acc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-models-cosmos-acc --default-identity UserAssignedIdentity=/subscriptions/2e9be2d7-cd16-4654-b3d6-9531fa26392e/resourceGroups/rg-models-acc/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-models-cosmos-acc --restore-timestamp 2026-01-05T12:51:02+00:00 --resource-group rg-models-acc --location "westeurope" --public-network-access DISABLED

Errors

(Forbidden) Message: {"code":"Forbidden","message":"Database Account riks-models-003-acc-westeurope does not exist\r\nActivityId: e6c403bd-eb0c-11f0-96f7-6045bd8bc30c, Microsoft.Azure.Documents.Common/2.14.0"}, Request URI: /operations/getstorageaccountsas, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0
Code: Forbidden
Message: Message: {"code":"Forbidden","message":"Database Account riks-models-003-acc-westeurope does not exist\r\nActivityId: e6c403bd-eb0c-11f0-96f7-6045bd8bc30c, Microsoft.Azure.Documents.Common/2.14.0"}, Request URI: /operations/getstorageaccountsas, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0

Issue script & Debug output

Sensitive

Expected behavior

The database gets restored

Environment Summary

PS C:\git> az --version
azure-cli                         2.80.0 *

core                              2.80.0 *
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.1

Dependencies:
msal                            1.34.0b1
azure-mgmt-resource               23.3.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\NC6318\.azure'
Extensions directory 'C:\Users\NC6318\.azure\cliextensions'

Python (Windows) 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botCosmosDBaz cosmosdbLanguageService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions