Skip to content

Commit

Permalink
Fix DateTime issue restoring deleted webapp (#16308)
Browse files Browse the repository at this point in the history
* Fix issue restoring deleted WebApp

Fixes [issue](#13245) that prevents restoring deleted WebApps if the host running the script uses a locale with a different date format than en-US.

* Update ChangeLog.md

Include changelog for Restore-AzDeletedWebApp DateTime fix
  • Loading branch information
Martin Bentancour authored Apr 2, 2022
1 parent 6a87b55 commit 00a2e50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Updated `Restore-AzDeletedWebApp` to fix issue that prevents the cmdlet from working on hosts with a locale is anything different from `en-US`

## Version 2.11.0
* Fixed `Set-AzWebAppSlot` to support MinTlsVersion version update [#17663]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private string GetDeletedSiteResourceId()
{
throw new Exception("Deleted app not found");
}
DeletedSite lastDeleted = deletedSites.OrderBy(ds => DateTime.Parse(ds.DeletedTimestamp)).Last();
DeletedSite lastDeleted = deletedSites.OrderBy(ds => DateTime.Parse(ds.DeletedTimestamp, new System.Globalization.CultureInfo("en-US"))).Last();
if (deletedSites.Count() > 1)
{
WriteWarning("Found multiple matching deleted apps. Restoring the most recently deleted app, deleted at " + lastDeleted.DeletedTimestamp);
Expand Down

0 comments on commit 00a2e50

Please sign in to comment.