Share via

Issue restoring sqlazure database from Long term retention using the REST API

97670328 1 Reputation point
2021-08-05T02:48:34.907+00:00

I am trying to copy a sqlazure database from long term retention using the documented REST API:
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy?api-version=2021-02-01-preview

I am passing all the info correctly but I receive copy is not supported feature in this subscription.
Anything I need to configure in my azure subscription?
I can do it from the portal but not from REST.
I have no issue using PITR restore from REST with no issue. It is just the restore from LTR.

Thanks

Khaled

Azure SQL Database
0 comments No comments

11 answers

Sort by: Most helpful
  1. 97670328 1 Reputation point
    2021-08-09T14:40:56.957+00:00

    Does anyone from Microsoft dev group that can help identifying the above error I have or have documentation about the error?
    Pl. let me know if you need any info to produce this.

    Thanks

    Khaled

    Was this answer helpful?

    0 comments No comments

  2. 97670328 1 Reputation point
    2021-08-06T00:17:04.073+00:00

    Thanks Oury. I was hoping to avoid using powershell. I am doing this in .NET and I was trying to use fluent or even REST API to avoid using powershell. This is part of any API I am offering to our client.

    Is this a bug in the REST API? any plan to fix it and when?

    Great thanks for helping.

    Khaled

    Was this answer helpful?

    0 comments No comments

  3. 97670328 1 Reputation point
    2021-08-05T08:09:47.03+00:00

    Here is the error I am getting:
    {\"error\":{\"code\":\"MissingRecoveryServicesRecoveryPointId\",\"message\":\"Missing recovery services recovery point Id.\"}}"

    I have tried the following request for PUT request body:

    {"properties":{"createMode":"RestoreLongTermRetentionBackup","recoveryServicesRecoveryPointResourceId":"/subscriptions/<mysub>/resourceGroups/<myresourcegroup>/providers/Microsoft.Sql/servers/<sqlservername>/databases/<sourcedb>/longTermRetentionBackups/<LTR-backupname>","sourceDatabaseId":"/subscriptions/<mysub>/resourceGroups/<myresourcegroup>/providers/Microsoft.Sql/servers/<mysqlserver>/databases/<dbtoberestored>"},"location":"<location>"}

    Thanks

    Khaled

    Was this answer helpful?


  4. 97670328 1 Reputation point
    2021-08-05T07:45:56.123+00:00

    Thanks Ben. Yes I am trying to restore the database from LTR.
    I have tried the create-or-update and it works well for Pitr restore.

    But for LTR, it asks about recoveryServicesRecoveryPointResourceId. Not sure what to specify for this param.

    Great thanks for helping.

    Khaled

    Was this answer helpful?

    0 comments No comments

  5. Ben Harding 1 Reputation point Microsoft Employee
    2021-08-05T04:59:43.977+00:00

    Hi Khaled,

    When you say you are trying to 'copy' the database, do you mean you want to restore it?
    If you are trying to perform a restore, you need to use the 'Create or Update' endpoint. Check the createmode option for restoring from LTR.
    https://learn.microsoft.com/en-us/rest/api/sql/2021-02-01-preview/databases/create-or-update#createmode

    Let me know how it goes

    Ben Harding

    Was this answer helpful?

    0 comments No comments

Your answer

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