-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webapp:Calling Set-AzWebApp with -HostNames can fail but returns an un-catchable warning that only indicates BadRequest #9316
Comments
There may not be enough here to move this defect forward but we did make the |
@shawnparslow When running in the try/catch block, did you pass |
@Nking92 @panchagnula This sounds like a regression in behavior from AzureRM, can you take a look? @dcaro FYI |
@markcowl yes, the script sets the |
we will check this with the new API version changes we are making |
Just adding that we have seen this a couple more times in our CI/CD system recently. The ErrorActionPreference is set to "Stop" and the Set-AzWebApp call does NOT got through (usually setting a binding that we just removed) but returns as a warning and is not hitting catch. We catch exceptions and have retry logic (in case the binding isn't released yet or something) but this failure seems to just slip through as a warning and doesn't ever hit the catch.
|
@Nking92 can you verify if this is fixed with this change #9496 |
@Nking92 ping? |
Closing this since we believe this should now be fixed. Please let us know if this is not the case. |
This doe snot appear to be resolved. Am I missing something here? Version Name Repository Description 2.6.0 Az PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compatible with WindowsPowerShell and PowerShell Core.... |
I can say the issue went away for me since upgrading to 2.5.0 in late July. I have a CI/CD system doing 100's of Azure deployments a day and we were only seeing this once or twice a week (in June/July timeframe) and have not seen this since that release. Not definitive but just my experience. |
@cpumanaz please reopen if this is not solved. |
This still appears to be a problem, I just ran into this. This is the error I got:
Which was not helpful at all. When I tried to do the same in the portal I got this error: Reopening because I have the power apparently 💪 |
I just hit this bug. It's basically impossible to script App Service custom DNS names and SSL certificates when App Service is used indirectly (e.g.: via App Gateway, Front Door, or a third-party NVA) because you can't point directly at App Service. You need the verification TXT record up-front, but it won't give it to you. For example, Get-AzWebSite returns "null" for CustomDomainVerificationId, which makes it impossible to script validation up-front. If I try to add a new host name first, without the custom verification, I get this BadRequest error. I can't do this through ARM Templates either because the DNS Zone is in a different Subscription, which makes it absurdly difficult. What should be straight forward is the following:
This just doesn't work though! |
Just hit the very same issue as @Tyriar described with latest bits. |
Quite helpful comment from @Tyriar, which lead me to the real root cause of the error (in my case). |
Description
In production we have a script that moves a hostname/binding from an app going idle to an app going live (removes the hostname/binding from a web app, update the DNSZone and re-create the hostname and then binding) on a web app that is going live. This code has run 100's of times but recently (about a week after we migrated from AzureRm to Az) we saw the call to create a new hostname suddenly fail but return a success (or rather did not throw an exception). Also, this call in AzureRm would output info but in Az it simply shows a warning an lists
'BadRequest
.Steps to reproduce
Not an exact reproduction of our production error (since in production we set the CNAME in the DNSZone to the new app and removed the hostname/binding from the one going idle) but to test the output you can just try to add www.foobar.com to a web app. In the debug output at the bottom this command threw a warning but the call returned successful (did not catch an exception).
Environment data
Module versions
Debug output
Unfortunately I can not capture debug output as this occurred once in production and then has not happened again. In the production context the hostname had just been deleted and the binding removed, the Azure DNSZone CNAME then gets updated to the new app and the call is made to add a host name below. My best guess is that Azure had not released the hostname yet but upon seeing the error I was able to re-run the call and create the hostname fine. My concern is that there is a bug where the catch {} in my production did not actually get tripped (so the Set-AzWebApp cmdlet appeared to have not thrown a catch-able exception upon failing to create the hostname). We have wrapped retry logic around these cmdlets but the exception was not caught and the cmdlet returned successful. Also, the warning info that showed up in the logs below simply indicated BadRequest and did not have the detail level the AzureRm cmdlet returns. I tried to test with similar calls (to create a hostname of a known site) but that call does fail and is caught (though it also says BadRequest where AzureRm listed more information). That aside, the instance below from production did not throw an exception and returned successful.
Error output
The text was updated successfully, but these errors were encountered: