Skip to content

az sql db ltr-backup restore can't restore a DTU style database  #26578

@jvandertil

Description

@jvandertil

Describe the bug

When trying to restore a Azure SQL Database using the DTU model the command fails with what seems to be an invalid request to Azure.

Related command

az sql db ltr-backup restore

Errors

(InvalidRequestContent) The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
Code: InvalidRequestContent
Message: The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.

Issue script & Debug output

Script:

$backupToRestore = $(az sql db ltr-backup list --database $DatabaseName --server $SqlServerName --location $AzureRegion `
                     | ConvertFrom-Json `
                     | Sort-Object -Property backupTime -Descending `
                     | Select-Object -First 1)

$DestinationDatabaseName = "$DatabaseName-" + (Get-Date -UFormat "%s")

Write-Host "Selected backup: $backupToRestore"
Write-Host "Restoring backup to $DestinationDatabaseName"

az sql db ltr-backup restore --backup-id "$($backupToRestore.id)" `
                             --dest-resource-group $DestinationResourceGroup `
                             --dest-server $DestinationServer `
                             --dest-database $DestinationDatabaseName `
                             --tier "Standard" `
                             --capacity 100 `
                             --debug

Debug log:

cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0184B4A8>, <function OutputProducer.on_global_arguments at 0x01918C40>, <function CLIQuery.on_global_arguments at 0x01938898>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'sql': ['azure.cli.command_modules.sql', 'azure.cli.command_modules.sqlvm']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: sql                       0.135        55       207
cli.azure.cli.core: sqlvm                     0.100         4        20
cli.azure.cli.core: Total (2)                 0.235        59       227
cli.azure.cli.core: Loaded 58 groups, 227 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : sql db ltr-backup restore
cli.azure.cli.core: Command table: sql db ltr-backup restore
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03BEB4F0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\****\.azure\commands\2023-06-01.11-05-05.sql_db_ltr-backup_restore.46968.log'.
az_command_data_logger: command args: sql db ltr-backup restore --backup-id {} --dest-resource-group {} --dest-server {} --dest-database {} --tier {} --capacity {} --family {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x03C255C8>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x03C25778>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x03C25808>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01918C88>, <function CLIQuery.handle_query_parameter at 0x019388E0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x03C257C0>]
Command group 'sql db ltr-backup' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=SqlManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\****\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\****\.azure\msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/****/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/****/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/****/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=SqlManagementClient
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/****/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/****/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/****/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/****/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 1056f63d-174c-41dd-b6a2-590da0442335
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****?api-version=2022-08-01-preview'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '66379829-005b-11ee-8697-ac74b1541e4b'
cli.azure.cli.core.sdk.policies:     'CommandName': 'sql db ltr-backup restore'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--backup-id --dest-resource-group --dest-server --dest-database --tier --capacity --family --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.49.0 (MSI) azsdk-python-mgmt-sql/4.0.0b10 Python/3.10.10 (Windows-10-10.0.22621-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****?api-version=2022-08-01-preview HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '83a765b1-1f2e-4fc6-98b4-0f24f0653cf9'
cli.azure.cli.core.sdk.policies:     'Server': 'Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '11987'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '9888c841-1f05-4770-bed9-bb79a18970e2'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'WESTEUROPE:20230601T090505Z:9888c841-1f05-4770-bed9-bb79a18970e2'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Thu, 01 Jun 2023 09:05:05 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"identity":{"principalId":"c726437f-8412-4bd4-bf86-13dbc1d422ca","type":"SystemAssigned","tenantId":"****"},"kind":"v12.0","properties":{"administratorLogin":"****","version":"12.0","state":"Ready","fullyQualifiedDomainName":"****.database.windows.net","privateEndpointConnections":[{"id":"/subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****/privateEndpointConnections/pl-****-6d6bfc0d-75e8-42a7-bb2c-181299ed9a7a","properties":{"privateEndpoint":{"id":"/subscriptions/****/resourceGroups/****/providers/Microsoft.Network/privateEndpoints/pl-****"},"groupIds":["sqlServer"],"privateLinkServiceConnectionState":{"status":"Approved","description":"Auto-approved","actionsRequired":"None"},"provisioningState":"Ready"}}],"minimalTlsVersion":"1.2","publicNetworkAccess":"Disabled","administrators":{"administratorType":"ActiveDirectory","principalType":"Group","login":"cld.aut.AzureData.RchPreDealDbAdmDev","sid":"602c7065-f0f0-498b-9709-3a6a67a63ced","tenantId":"****","azureADOnlyAuthentication":true},"restrictOutboundNetworkAccess":"Disabled","externalGovernanceStatus":"Disabled"},"location":"westeurope","id":"/subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****","name":"****","type":"Microsoft.Sql/servers"}
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 1da9d26e-d773-49aa-9c57-cbbe5e5f3819
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****/databases/****-1685610305?api-version=2022-08-01-preview'
cli.azure.cli.core.sdk.policies: Request method: 'PUT'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies:     'Content-Length': '492'
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '66379829-005b-11ee-8697-ac74b1541e4b'
cli.azure.cli.core.sdk.policies:     'CommandName': 'sql db ltr-backup restore'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--backup-id --dest-resource-group --dest-server --dest-database --tier --capacity --family --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.49.0 (MSI) azsdk-python-mgmt-sql/4.0.0b10 Python/3.10.10 (Windows-10-10.0.22621-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"location": "westeurope", "sku": {"tier": "Standard", "family": "S3", "capacity": 100}, "properties": {"createMode": "RestoreLongTermRetentionBackup", "longTermRetentionBackupResourceId": "/subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/locations/westeurope/longTermRetentionServers/****/longTermRetentionDatabases/****/longTermRetentionBackups/ace635ba-52a9-4b2d-b6a9-729e8dda3ec0;133298858200000000"}}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/****/resourceGroups/****/providers/Microsoft.Sql/servers/****/databases/****-1685610305?api-version=2022-08-01-preview HTTP/1.1" 400 162
cli.azure.cli.core.sdk.policies: Response status: 400
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'x-ms-failure-cause': 'gateway'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': 'c94cc574-be7f-42b8-80bc-fe18d8af1793'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': 'c94cc574-be7f-42b8-80bc-fe18d8af1793'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'WESTEUROPE:20230601T090506Z:c94cc574-be7f-42b8-80bc-fe18d8af1793'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Thu, 01 Jun 2023 09:05:05 GMT'
cli.azure.cli.core.sdk.policies:     'Content-Length': '162'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"InvalidRequestContent","message":"The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'."}}      
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/sql/custom.py", line 3214, in restore_long_term_retention_backup
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/sql/operations/_databases_operations.py", line 1155, in begin_create_or_update
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/sql/operations/_databases_operations.py", line 1013, in _create_or_update_initial
azure.core.exceptions.HttpResponseError: (InvalidRequestContent) The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
Code: InvalidRequestContent
Message: The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.

cli.azure.cli.core.azclierror: (InvalidRequestContent) The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
Code: InvalidRequestContent
Message: The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
az_command_data_logger: (InvalidRequestContent) The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
Code: InvalidRequestContent
Message: The request content was invalid and could not be deserialized: Required property 'name' not found in 'sku'.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x03BEB610>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 1.465 seconds (init: 0.325, invoke: 1.140)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3758 in cache

Expected behavior

Database backup restore is started

Environment Summary

azure-cli 2.49.0

core 2.49.0
telemetry 1.0.8

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botSQLaz sqlService AttentionThis issue is responsible by Azure service team.act-codegen-extensibility-squadbugThis 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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions