How do you check the status of a SQL Import Export Operation in Azure?

Viewed 6421

I am performing a SQL Database Import using a BacPac file to Azure using the REST management API. I need to be able to check the status of an import, as Azure does not allow for me to send events when the import succeeds.

Here is the documentation for the operation I am performing: https://docs.microsoft.com/en-us/rest/api/sql/databases%20-%20import%20export/import

I have already tried using the Azure's Analysis Services API to check an operation's status by the operation id and the region it occurred in. Calling this endpoint however is returning me a 404 not found.

Here is the documentation for Azure's Analysis Services API endpoint I am attempting to call with my import's operation id and the region it occurred in: https://docs.microsoft.com/en-us/rest/api/analysisservices/servers/listoperationresults

I am expecting the Analysis Services to provide me with the status of an import/export operation I started using the Azure Management API. Doing so is resulting in a 404, so I'm not sure if I'm calling the correct API endpoint (I double checked to make sure there are no typos in the URI I am building to check the operation status).

6 Answers

in the database go to overview -> in the bottom check notifications -> you do make click in tha image

enter image description here

enter image description here

I find an article Azure SQL Database Export, it talked about how to check the status of an export by using the Microsoft Azure SQL Database Import/Export REST service API.

Summary:

In the Management Portal, click on the database and the dashboard will show you the recent export status. In Screenshot 5, you will see that the AUTOMATED EXPORT status for my database shows as NEVER EXPORTED. This will change once a successful export is done. In the Management Portal, click on the database and the dashboard will show you the recent export status. enter image description here

After the export completes which was ultimately scheduled at 1AM, completed after 5 minutes and the automated export status in my dashboard shows that the same. (See screenshot 6). enter image description here

Hope this helps.

According to Microsoft:

"We have REST API’s for Import/Export operations into Azure sql but we don’t have any REST API to find Import/Export status. Customer should use Powershell to get status"

I also discovered that it is not possible to know if an import failed using the Powershell command, because it doesn't have a database uri (because the import failed) to hit for checking the import status.

For any api such as BeginX(), there is a corresponding api X() which waits for completion. In this case, instead of BeginImport() use Import().

If you wish to have more direct control over the polling, then you can look inside the definition of Import and directly use the lower layer, i.e. BeginImportWithHttpMessagesAsync() and then GetPostOrDeleteOperationResultAsync():

        public async Task<AzureOperationResponse<ImportExportResponse>> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Send request
            AzureOperationResponse<ImportExportResponse> _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);

            // Poll for completion
            return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
        }

This answer is specifically for .net but for other languages the same principle applies.

Related