且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Azure“启用AD身份验证"带有部署槽

更新时间:2023-12-03 15:08:28

创建部署插槽时,需要为其重新设置身份验证,就好像它是一个新应用程序一样. (从应用程序服务的角度来看,是这样.)

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.)

步骤大致为:

  1. 在门户中,转到您的应用程序服务下的部署插槽.
  2. 进行身份验证/授权
  3. 执行所有步骤来设置与生产应用程序相同的身份验证/授权. (通过AzureAD进行身份验证,选择提供程序,等等.)
  4. 在登台环境的管理应用程序"下,转到设置,并为登台环境添加新的答复URL.您应该有常规的回复URL,然后是暂存版本:

  1. In the portal, go to your deployment slot under your app-service.
  2. go to authentication/authorization
  3. Go through all the steps to setup your authentication/authorization the same as for your production app. (Authenticate via AzureAD, Choose the provider, etc.)
  4. 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

然后您应该可以进入.

发生在我身上的一件奇怪的事情是,这没有用,然后我进入了阶段身份验证,然后将其关闭.这使一切正常工作,并且经过了正确的身份验证,并且如果我没有登录也不允许我进入.

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.)