Skip to content

Commit 8229206

Browse files
[AppService]: fix #9316-Calling Set-AzWebApp with -HostNames can fail but returns an un-catchable warning that only indicates BadRequest (#15639)
* Fix #9316 - Calling Set-AzWebApp with -HostNames can fail will returns an catchable warning with proper error descreption. * Updated changelog.md * Update ChangeLog.md Co-authored-by: Yabo Hu <[email protected]>
1 parent aa24916 commit 8229206

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Websites/Websites/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed `Set-AzWebApp` to return a valid warning message when fails to add -Hostname #9316
22+
* Fixed `Get-AzWebApp` to return CustomDomainVerificationId in the response. #9316
2123

2224
## Version 2.8.1
2325
* Fixed `Add-AzWebAppAccessRestrictionRule` failing when users does not have permissions to get Service Tag list #15316 and #14862

src/Websites/Websites/Models.WebApp/PSSite.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public PSSite(Site other)
6262
suspendedTill: other.SuspendedTill,
6363
slotSwapStatus: other.SlotSwapStatus,
6464
httpsOnly: other.HttpsOnly,
65-
identity: other.Identity
65+
identity: other.Identity,
66+
customDomainVerificationId: other.CustomDomainVerificationId
6667
)
6768
{
6869
PropertyInfo AzureStoragePathProp = other.GetType().GetProperty("AzureStoragePath");

src/Websites/Websites/Utilities/WebsitesClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ public void AddCustomHostNames(string resourceGroupName, string location, string
161161
}
162162
}
163163
}
164-
catch (Exception e)
164+
catch (DefaultErrorResponseException e)
165165
{
166-
WriteWarning("Could not set custom hostname '{0}'. Details: {1}", hostName, e.ToString());
166+
WriteWarning("Could not set custom hostname '{0}'. Details: {1}", hostName, e?.Response?.Content?.ToString());
167167
return;
168168
}
169169
}

0 commit comments

Comments
 (0)