Problem:
You are trying to take a native SQL Backup to URL and you receive the error below:
Msg 3271, Level 16, State 1, Line 1
A nonrecoverable I/O error occurred on file “https://MyStorageAccount.file.core.windows.net/MyContainer/Adventureworks_full_20190420.bak:”
Backup to URL received an exception from the remote endpoint. Exception Message: The remote server returned an error: (400) Bad Request..
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Cause:
You are trying to save a blob file using to non-blob storage or not using the Blob storage endpoint. Check your URL to see if you are pointing to the correct one. SQL Server backups can only be saved to Blob storage. If you are using general purpose storage, you will have multiple endpoints for different usage. You should be using the Blob url for SQL backups – see from the picture below. The one in the green box is the Blob storage endpoint. Using any other endpoints would result in a Bad Request Error. The same is true when using the other endpoints. You should be using it for the correct file types.
Fix:
Review the url path you are trying to restore to and make sure you are using the correct endpoint for Blob Storage.
2 Comments. Leave new
Hi ,
Iam uasing coorect end point but still face the same
I works if you use shared secret rather than the access key directly.
1) get access key:
To get he Shared Access Key, click on the storage account
on the menu select Shared Access Signature
Fill in the details, including IP Range and dates (watch default dates don’t expire immediately)
Then Press [Generate SAS and Connection String] button at the bottom
2) create certificate
CREATE CREDENTIAL [https://{Storage Account}.blob.core.windows.net/cont000002]
WITH IDENTITY = N’SHARED ACCESS SIGNATURE’,
SECRET = N'{Shared Secret}’
GO
3) backup
backup database Test
to url = N’https://{StorageAccount}.blob.core.windows.net/c{Container}/{filename}’
go