Azure x-ms-routing-name to route to deployment slot - azure

I cannot get x-ms-routing-name to do anything when I explicitly specify it in the URL or in a cookie. I am sure I have had it working in the past.
I have a Web App with the default (production) and a deployment slot called "prerelease", which I want to route some customers to as an early access version.
I have gone into 'Testing in Production' configuration and set the "prerelease" slot to 0%. I've tried it both with and without Traffic Manager, and over both HTTP and HTTPS.
I've been through this post and can't see anything else to help me: https://learn.microsoft.com/en-in/azure/app-service-web/app-service-web-test-in-production-get-start
Why might this not be working?

It turns out that this is an intermittent Microsoft Azure bug. The x-ms-routing-name cookie occasionally stops after you swap slots. We have an active support request open with Microsoft. It seems that they fix the problem, but it re-occurs after some time.
Edit: workaround is to go into the app => Testing in Production, make a change to activate the Save button and click save. This will trigger routing to start working again.

Related

"403 - This web app is stopped" when deploying to Azure from VSCode

I have a web app, ironradio.org, that I've deployed on Azure from VSCode. I've made some updates to the site and am now trying to deploy the newest version. Now when I try to deploy using this button:
I get the error 403 - This web app is stopped in the output window:
I've already deployed several versions of the site using the same method and it's never failed before. Also, the app is definitely not stopped because I can still browse to the site and it shows up.
My best guess as to what's going on is that I associated the App Service with a new resource group since the last deployment, so maybe VSCode isn't recognizing that? Does anyone have any idea what's going on here?
I tried the link given in the error message, but it wasn't much help.
Microsoft foreseen this type of error and how it can affected its customers greatly and this is why the deployment slot is for you.
Firstly, you have to delete the app and reupload again except you set up continuous deployment which work mostly with GitHub and other version control platforms.
Apart from this, I will suggest you check out the deployment slot docs. It’s very simple and easy to use
https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots

infinite redirect loop after login from Azure Active Directory to web app - not HTTPS issue

I'm seeing some really strange behavior in one of my azure applications. I'm using OpenID and Azure Active directory for logging into my site. When I first deploy my application and log in, it works perfectly and will continue to work (log out and log back in) for that entire browser session. However, if I try and log in from another computer, it gets stuck in an infinite redirect loop from the MS login page to my site. If I then close my browser session and try logging in again, it also gets stuck in the loop....The login is only successful the first time after a new deployment.
I've had a similar problem in the past where I'm hitting the site on http and it's redirecting back from https, this is not the case here.
Here are some things I've tried to resolve this:
Update the app key in Azure AD
Recreate the app in Azure AD
Delete cookies on browser
Ensure I'm hitting https by forcing a redirect in web.config
I have several other applications in my same subscription that are working just fine and as best I can tell, this one is set up identically to those.
I'm fresh out of ideas of things to try here.
any suggestions would be greatly appreciated
Quick Edit: We have dev, qa and prod/staging environments set up. this is only happening in QA. It doesn't do it when I debug from VS, it's fine in Dev, and also fine in staging.

Internal Server Error 500 - Azure App Service hosting Microsoft Bot Framework

My bot on Azure used to work normally some days before without any issue for a year now.
But suddenly, when a user sends a message to the server, the server does not respond and has a Internal Server Error 500, with detailed error information regarding the ManagedPipelineHandler and System.Web.Http.WebHost.HttpControllerHandler
There was a temporary issue with the default state service September 15th. The bug has been fixed. https://github.com/Microsoft/BotBuilder/issues/3466
The default state service is not intended for production bots. Using the Azure Extensions for state is recommended. Please review: https://blog.botframework.com/2017/07/18/saving-state-azure-extensions/
Reason: The reason this happens is the fact you’ve deployed a binary which doesn’t have an old name (SampleEchoBot.dll). As the web application has now a second binary which tries to host a Messages controller. More details can be found when accessing it via web browser
Solution: To fix it you need to modify your publish profile. Click Publish once again, switch to Settings tab, expand the File Publish Options and check the Remove additional files at destination. After another publish you can deselect this option. The bot should respond now as expected.

Azure "Enable AD Authentication" with deployment slots

I have an Azure WebApp and have activated the "Active Directory Authentication" in the Azure Preview Potal. Let's call it https://mysite.azurewebsites.net (not a real URL) Whis works as expected. However, when we add a deployment slot, we can't get authentication to work properly. When accessing the staged WebApp, e.g. https://mysite-staging.azurewebsites.net (not a real URL), we get redirected to
https://login.microsoftonline.com/<our-directory-guid>/oauth2/authorize?response_type=id_token&redirect_uri=https%3A%2F%2Fmysite-staging.azurewebsites.net/....
But the login portal gives us an error message:
AADSTS50011: The reply address 'https://mysite-staging.azurewebsites.net/<our-appliction-guid>/login' does not match the reply addresses configured for the application: .
The problem is, the WebApp does not show up as an application in our directory, so we can't set up alternate reploy URLs for it.
Is there any way to specify alternate addresses for WebApps, so that Azure AD login will work for deployment slots?
When you create the deployment slot, you need to re-setup the authentication for it, as if it's a new application. (From an app-service perspective, it is.)
The steps are roughly:
In the portal, go to your deployment slot under your app-service.
go to authentication/authorization
Go through all the steps to setup your authentication/authorization the same as for your production app. (Authenticate via AzureAD, Choose the provider, etc.)
Under "Manage App" in the staging environment, go to settings, and add new reply URL's for your staging environment. You should have your regular reply URL, and then the staging version:
https://myapp.azurewebsites.net/signin-oidc
https://myapp-staging.azurewebsites.net/signin-oidc
You should then be able to get in.
One weird thing that happened to me, is this didn't work, then I went into the staging authentication, and turned it off. That made everything work, and it correctly authenticated and didn't let me in if I wasn't signed in.
(I realize I'm posting this answer years after the original question, but after spending the better part of a week figuring it out, and this question repeatedly came up on searched, I wanted to document what I ended up doing in case someone else has a problem.)
I sure this will not fix the deployment slot is still pointing to live app but this fix this error as it is very silly.
AADSTS50011: The reply address 'https://mysite-staging.azurewebsites.net//login' does not match the reply addresses configured for the application: .
When you configure your URL under the application settings in Azure AD, you forgot… a trailing slash! That’s it! Can you believe that?
In other words, change this:
http://yoururlforyourapp
to this:
http://yoururlforyourapp/
Done! You’re welcome.
From http://www.matvelloso.com/2015/01/30/troubleshooting-common-azure-active-directory-errors/
Unfortunately it looks like you ran into some bugs in that version of the preview portal.
The Reply URL issue is likely because you created the staging slot after you configured auth on the production slot. In that version, we cloned the auth settings so your staging slot ended up pointing to the existing AAD application without adding the new Reply URL. This issue has been fixed by not auto-cloning auth settings when a new slot is created.
In any case, you should be able to find your application in the AAD management portal. If you're not able to see it, it could be because you need to change the "Show" dropdown filter from "Applications my company uses" to "Applications my company owns". Locating it and adding the staging Reply URL would have also worked around the issue mentioned above.
The error message you saw when trying to re-configure auth on your staging slot was likely another bug in the management portal if you were only seeing it on that staging slot.
The Authentication / Authorization blade has been radically updated since your question was asked, and all of these issues should be fixed now. Sorry for the inconvenience. I hope you were able to make progress in spite of these issues.

In Azure, how do I start a continuous WebJob that was uploaded programmatically

As part of an automation, I have created a WebJob that gets HTTP-uploaded to a WebSite application that places eveything into the expected folders as described here (the indirection is mostly to save upload-bandwidth). The only problem now is, that this WebJob won't start running until I load the WebSite's Dashboard in the management portal.
I have tried to mimic the web requests the portal does when showing the Dashboard within my application in the hopes of doing what's necessary, but so far I have been unable to find the correct call (-sequence?). I don't really expect GetAutoScaleCostInfo or GetMonitoringConfiguration to help…
What's the magic pixie dust I'm missing and the portal is doing?
To make sure the WebJob (and Website) is always running (and will always run) you need to set the Always On configuration setting, this will make sure the WebJob is started and keeps going (for a continuous WebJob).
Note that it is only available for standard/basic website instances.
In general to start the WebJob container you need to make an http request to https://{sitename}.scm.azurewebsites.net (providing your deployment credentials as basic auth).

Resources