Azure SQL Dbs are in an inaccessible state on the Azure Portal

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

When I am not able to connect to the Azure SQL db, and I get this error message, 

 

Akshay_Manjeshwar_0-1680580585061.png

 

My first step would be to check the status of the database on the Azure Portal, and in this case, I can see that the dbs are in inaccessible state.

 

Akshay_Manjeshwar_1-1680580658053.png

 

When I check the Activity logs, I see the following events:

 

Akshay_Manjeshwar_2-1680580704546.png

 

If I click on the JSON events, I can see the reasons why the dbs are inaccessible

 

Akshay_Manjeshwar_4-1680580870794.png

 

 and there's another status which shows that the dbs are waiting for access to be reestablished again. 

 

Akshay_Manjeshwar_8-1680581002921.png

 

When I click on Revalidate Key, at the bottom of the screen, it gives the correct error. 

 

Akshay_Manjeshwar_0-1680582156323.png

 

Now when I go to Identity, I can see that the System assigned managed identity was turned to off.

 

Akshay_Manjeshwar_11-1680581117777.png

 

Resolution

===========

Step 1 : Turn it on.When I try to turn it on I get the following error msg

 

Akshay_Manjeshwar_12-1680581332508.png

 

 

Step 2: The way to resolve this error is to go back to the Azure key vault access policies and then add the system assigned managed identity with the correct permissions: Get, Wrap and Unwrap keys.

Akshay_Manjeshwar_13-1680581400553.png

 

Step 3: Click on Create. Select the permissions and then click Next

Akshay_Manjeshwar_14-1680581445441.png

 

Step 4: Use the system assigned managed identity and then click on Next

 

 

Akshay_Manjeshwar_15-1680581551498.png

Step 5: Click on Create.

 

Step 6: Once the access policy was created successfully, you can go back to the Identity tab of the SQL Server and then see the System assigned managed identity has been turned to On automatically.

 

Step7: Go back to TDE settings and click on Revalidate Key.

 

Step 8: You will see the access is back. Depending on the size of the dbs, it will take some time for the restoration process.

 

Akshay_Manjeshwar_16-1680581689593.png

 

Step 9: Once the restoration process is completed, you will get a notification: Key Access restored.

 

Step 10: Dbs will be back in Online state as well and now you should be able to connect to the dbs as well. 

 

Akshay_Manjeshwar_17-1680581741975.png

 

Refer: Common errors with customer-managed keys in Azure Key Vault - SQL Server | Microsoft Learn

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.