WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
117 stars 56 forks source link

Restore Backup based on DateTime #146

Closed mVermaat closed 4 years ago

mVermaat commented 4 years ago

I want to restore a backup from a specific DateTime (a system backup, not a manual backup). I noticed that the task only allows the use of a Label. I saw the CmdLet from Microsoft does support it.

I was going to make a PR that has the added variable, however I see that Azure DevOps doesn't allow input parameters to be a DateTime. See Schema.

Before spending some time of making this. @WaelHamze, what is your opinion on this?

mVermaat commented 4 years ago

I noticed something strange.

The Management API Reference states it has a 'CreatedOn' parameter. This would work The Cmdlet API Reference has a InstanceRestorePoint parameter in the documentation, however if i look into the module itself it doesn't have it. It really needs a backup ID. My next check was to get all the backups and match based on DateTime. This didn't really get anywhere, because when I print all the backups. The system backups don't have an ID and only have 1 per 24 hours instead of the 30 minutes available in the admin portal. (see screenshot below)

image

Anyone have any pointers how to do this?

WaelHamze commented 4 years ago

@mVermaat I can't see how you can achieve this with the current APIs. I couldn't find the restore point in the PS module once loaded in PS ISE.

Regarding input parameter, it would have to be a string that can be parsed into a datetime in UTC preferably. If you want to get complicated you can create a datetime control for this :)

Anyway we need the API for this first. I'll see if I can get more info on how to do this.

mVermaat commented 4 years ago

Awesome, thanks!

WaelHamze commented 4 years ago

@mVermaat Let me know how it works for you. I tried to keep it backwards compatible. So it retrieves the backup timestamp from label as the new api doesn't support restore using backupid

mVermaat commented 4 years ago

@WaelHamze I just included your change in my pipeline. It works great!