From b2aabeeaff40565883d38b9bdb14593c7a34ada0 Mon Sep 17 00:00:00 2001 From: Khuram Khan Date: Wed, 15 Jun 2022 17:49:32 -0500 Subject: [PATCH 1/2] adding check for zip deployment --- .../Websites/Cmdlets/WebApps/PublishAzureWebApp.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs b/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs index fa6d4894b700..23f2058bc6cc 100644 --- a/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs +++ b/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs @@ -89,6 +89,15 @@ public override void ExecuteCmdlet() fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/zip"); r = client.PostAsync(deployUrl, fileContent).Result; + // Checking the response of the post request. If the post request fails with 502 or 503 HTTP status + // then deployments/latest endpoint may give false postive result. + if (r.StatusCode != HttpStatusCode.OK && r.StatusCode != HttpStatusCode.Accepted) + { + var rec = new ErrorRecord(new Exception("Deployment failed with status code " + r.StatusCode), string.Empty, ErrorCategory.InvalidResult, null); + WriteError(rec); + return; + } + int numChecks = 0; do { From 22498d94f025dbc87a9186da357bbb00cd515641 Mon Sep 17 00:00:00 2001 From: Khuram Khan Date: Thu, 16 Jun 2022 00:20:24 -0500 Subject: [PATCH 2/2] update the change log --- src/Websites/Websites/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index ad2d24eaab76..e44e151c31cb 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -21,6 +21,7 @@ ## Version 2.11.2 * Updated `Get-AzWebApp` and `Get-AzWebAppSlot` to expose `VirtualNetworkSubnetId` property [#18042] +* Updated `Publish-AzWebApp` to avoid the false positive result when zip deploy is not reachable. ## Version 2.11.1 * Updated 'New-AzWebAppContainerPSSession' with CmdletDeprecation Attribute [#16646] * Updated `Restore-AzDeletedWebApp` to fix issue that prevents the cmdlet from working on hosts with a locale is anything different from `en-US`