Hi PS,
Thanks for reaching out to Microsoft Q&A.
A .bak file is a backup file of a SQL Server database that contains the data and the log files of the database. To restore a .bak file to Azure SQL Managed Instance, you have a few options:
- You can use SQL Server Management Studio (SSMS) to restore the database from Azure Blob Storage to Azure SQL Managed Instance by using the restore wizard.
- You can first restore the .bak file to a local SQL Server instance, then export the database as a .bacpac file, and then import the .bacpac file to Azure SQL Managed Instance by using the Azure portal or SSMS.
You can't overwrite an existing database during restore.
Hence overwriting is not possible. You can restore to a new name, drop the old database, and rename the new one.
Try using 'Restore-AzSqlDatabase' for restoring azure SQL database using PowerShell command.
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.