Intermittent ResourceNotFound (404) During Azure SQL Database Rename

Nagothu, Venkatesh 0 Reputation points
2026-11-27T06:26:19.9966667+00:00

Hello Microsoft Azure Support Team,

We are experiencing intermittent ResourceNotFound (HTTP 404) errors during Azure SQL Database rename operations as part of our automated daily reporting database refresh process.

Environment:

  • Azure SQL Database — General Purpose Serverless, Gen5, 1 vCore

Source and target servers are in the same Azure region

PowerShell automation using Azure CLI

Managed identity authentication

Current process:

Copy the source database to a temporary database.

Update the temporary database configuration.

Disable auto-pause on the existing reporting and temporary databases.

Rename the existing reporting database to a backup name.

Rename the temporary database to the reporting database name.

Validate the refreshed database and delete the previous copy.

Issue observed:

The database copy and configuration updates generally succeed. However, the first rename operation intermittently fails with:

ResourceNotFound (HTTP 404)

The issue occurs in Production, while the same PowerShell logic generally works in Nonprod.

Findings from Azure Activity Log:

During one failed rename execution, we observed the following sequence:

Time (UTC)OperationResult00:20:26Update destination database resourceFailed — HTTP 40400:20:28Update destination database resourceSucceeded — HTTP 20000:20:28Delete original database resourceSucceeded — HTTP 20400:20:29Update destination database resourceSucceeded — HTTP 20000:20:32Rename original databaseFailed — HTTP 404The update and delete operations were recorded under an Azure SQL control-plane application identity.

Questions:

Could these update and delete events be internal operations performed as part of the Azure SQL database rename process?

Why might the rename return ResourceNotFound after successful operations involving the destination and original database resources?

Is it possible for the rename to complete partially or successfully while the overall management request returns HTTP 404?

Are there known issues or timing considerations involving database rename operations on the General Purpose Serverless tier?

What readiness checks and state-aware retry mechanisms does Microsoft recommend?

Is there a recommended alternative for reliably refreshing a complete reporting database, including schema, stored procedures, and data?

We would appreciate your guidance on the likely cause and recommended mitigation.

We can provide the relevant correlation IDs and additional diagnostic information through an approved secure support channel if required.

Thank you.Hello Microsoft Azure Support Team,

We are experiencing intermittent ResourceNotFound (HTTP 404) errors during Azure SQL Database rename operations as part of our automated daily reporting database refresh process.

Environment:

Azure SQL Database — General Purpose Serverless, Gen5, 1 vCore

Source and target servers are in the same Azure region

PowerShell automation using Azure CLI

Managed identity authentication

Current process:

Copy the source database to a temporary database.

Update the temporary database configuration.

Disable auto-pause on the existing reporting and temporary databases.

Rename the existing reporting database to a backup name.

Rename the temporary database to the reporting database name.

Validate the refreshed database and delete the previous copy.

Issue observed:

The database copy and configuration updates generally succeed. However, the first rename operation intermittently fails with:

ResourceNotFound (HTTP 404)

The issue occurs in Production, while the same PowerShell logic generally works in Nonprod.

Findings from Azure Activity Log:

During one failed rename execution, we observed the following sequence:

Time (UTC)OperationResult00:20:26Update destination database resourceFailed — HTTP 40400:20:28Update destination database resourceSucceeded — HTTP 20000:20:28Delete original database resourceSucceeded — HTTP 20400:20:29Update destination database resourceSucceeded — HTTP 20000:20:32Rename original databaseFailed — HTTP 404The update and delete operations were recorded under an Azure SQL control-plane application identity.

Questions:

Could these update and delete events be internal operations performed as part of the Azure SQL database rename process?

Why might the rename return ResourceNotFound after successful operations involving the destination and original database resources?

Is it possible for the rename to complete partially or successfully while the overall management request returns HTTP 404?

Are there known issues or timing considerations involving database rename operations on the General Purpose Serverless tier?

What readiness checks and state-aware retry mechanisms does Microsoft recommend?

Is there a recommended alternative for reliably refreshing a complete reporting database, including schema, stored procedures, and data?

We would appreciate your guidance on the likely cause and recommended mitigation.

Thank you.

Azure SQL Database
0 comments No comments

2 answers

Sort by: Most helpful
  1. kagiyama yutaka 5,935 Reputation points
    2026-11-27T08:58:26.0466667+00:00

    I think the script above misses one thing. A failed az sql db show doesn't mean the database is gone.

    Check both databases with az sql db op list before renaming. After a 404, run az sql db list and check $LASTEXITCODE immediately. If it fails or the rename result is unclear, stop the refresh and contact Azure Support with the correlation IDs. Don't delete anything. If possible, switch the connection string to a validated copy with a unique name. Keep the old database until the application has been tested.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-27T06:27:44.3933333+00:00

    Treat an HTTP 404 from az sql db rename as an indeterminate outcome: query both the old and new database names, accept the rename if the new name exists and the old name does not, and retry only after the old name is confirmed to exist and the destination name is confirmed absent.

    Azure SQL Database rename changes the database resource identifier and is not documented as idempotent; therefore, immediately repeating a failed request could target a name that no longer exists. The supported CLI operation is az sql db rename --name ... --new-name ....^1^

    1. Wait for the temporary copy to become Online.
      A copy is not ready merely because the destination resource appears. During seeding, sys.databases.state_desc is COPYING; completion is represented by ONLINE. The copy must not still be in progress when renamed.^2^
    2. Allow preceding configuration updates to settle.
      Poll both reporting and temporary databases until their control-plane status is stable. Do not overlap scaling, auto-pause configuration, copy completion, delete, and rename requests.
    3. Stop reporting connections before each rename.
      Azure SQL Database cannot rename a database while users are connected. It also cannot rename one participating in active geo-replication or still creating a database copy.^3^
    4. Rename, then reconcile names before deciding whether to retry.
    az sql db rename -g $rg -s $server -n $oldName --new-name $newName
    
    $old = az sql db show -g $rg -s $server -n $oldName `
        --query status -o tsv 2>$null
    $new = az sql db show -g $rg -s $server -n $newName `
        --query status -o tsv 2>$null
    
    if ($new -and -not $old) { "Rename completed" }
    elseif ($old -and -not $new) { throw "Safe to retry after bounded backoff" }
    elseif ($old -and $new) { throw "Destination collision; do not retry" }
    else { throw "Indeterminate state; stop and escalate" }
    

    For a retryable state, use a small bounded retry count with exponential backoff and jitter. Azure Resource Manager explicitly recommends checking the operation or final resource state before resubmitting an interrupted asynchronous operation; its usual transient candidates are 408 and 5xx, not every 404.^4^

    Interpreting the Activity Log

    The documented rename REST operation is a control-plane POST to the source database’s /move endpoint with the target database resource ID in the request body.^5^ This establishes that rename changes the resource identity, but the public documentation does not specify that the exact update/delete records you observed are guaranteed internal sub-operations of rename.

    Accordingly:

    • The Microsoft.Sql control-plane identity and close correlation in time are consistent with service-managed processing, but are not enough to conclusively classify those events.
    • A 204 delete followed by updates can be compatible with an identity-changing operation, but it does not prove that the parent request completed correctly.
    • The rename can have changed the final resource state even when the client received an error. Resource Manager warns not to assume an interrupted management operation failed; inspect final state first.^4^
    • A ResourceNotFound means Resource Manager could not retrieve the resource identified by that request. Verify the exact subscription, resource group, server, and database names recorded in the failed operation.^6^

    Use the Activity Log correlation ID to group the events and preserve the full error response, caller, resource ID, operation name, timestamps, and client request ID. Azure SQL Activity Log events can be queried through the AzureActivity table.^7^

    Serverless considerations

    No published Microsoft documentation identifies intermittent rename 404s as a known General Purpose Serverless defect. Serverless auto-resume commonly takes about one minute, but its documented first-connection symptom is database-unavailable error 40613, not a control-plane ResourceNotFound response.^8^

    Since auto-pause is already disabled in this workflow, focus on overlapping control-plane operations, copy completion, open connections, and post-error reconciliation rather than repeating that configuration step.

    Alternative refresh methods

    Your database-copy approach is the strongest full-database refresh mechanism listed here: it creates a transactionally consistent copy that becomes an independent database and includes database users, permissions, schema, stored procedures, and data.^2^ The remaining risk is the name-swap cutover, so harden that stage rather than replacing the copy.

    If a slower, file-based refresh is acceptable, SqlPackage can export schema and user data to a BACPAC and import it as a new database. BACPAC files are compressed but not encrypted and must be protected appropriately.^9^ It still does not provide an atomic replacement of an existing database name.

    If the failure remains reproducible after serialized operations and state-aware reconciliation, open an Azure support request and provide both successful and failed correlation IDs, full Activity Log JSON, exact CLI version/command output, database operation timestamps, and the old/new resource IDs. That evidence is required to determine whether the observed update/delete sequence came from Microsoft.Sql rename processing.


    References

    1. az sql db rename
    2. Copy a transactionally consistent copy of a database in Azure SQL Database
    3. Modifiable configuration reference for Azure SQL Database
    4. Reliability in Azure Resource Manager
    5. Databases - Rename - REST API (Azure SQL Database) | Microsoft Learn
    6. Resolve errors for resource not found
    7. Azure SQL Database monitoring data reference
    8. Auto-pause and auto-resume in the serverless compute tier for Azure SQL Database
    9. SqlPackage
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.