Azure SQL : Can we perform point-in-time restore using managed identities

MANDA Rajendar 1 Reputation point
2022-04-19T06:53:57.723+00:00

Hi MS,

We are doing some azure sql database updated activities from micro services. Before performing this activity, we are storing time in UTC form. If this activity fails we would like to restore database using Point-in-Time restore functionality to previous state. We are able to restore data by azure sql SDK (Microsoft.Azure.Management.ResourceManager.Fluent) functions. Now we don't want to store admin credential in micro service. Can we perform Point-in-Time restore using Managed identities or any other without giving admin credentials

Regards,
Rajendar Manda

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,631 Reputation points
    2022-04-19T14:40:27.813+00:00

    Hi @MANDA Rajendar , welcome to Microsoft Q&A forum.

    From the question we understand that you want to restore pitr backups without using sql admin credentials.
    We can achieve this using azure sql rest APIs through code:

    Sample Request:

    PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/dbpitr?api-version=2021-11-01-preview  
    

    Request Body:

      {  
          "location": "southeastasia",  
          "properties": {  
            "createMode": "PointInTimeRestore",  
            "sourceDatabaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",  
            "restorePointInTime": "2020-10-22T05:35:31.503Z"  
          }  
        }  
    

    Reference: Creates a database from PointInTimeRestore

    One of the way to call the rest apis is mentioned in below series of article:

    How to get Azure Access Token using C#

    Please let us know if this helps or else we can discuss further on the same.

    0 comments No comments

Your answer

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