使用Azure AD身份验证设置Azure Web应用程序后,该站点在验证后返回401
。使用Azure AD App的Azure Web应用程序返回`auth/login/aad/callback`权限
这是我看到它的认证流程。
- 转到
https://mysite-$environment.azurewebsites.net/
- 到
https://login.microsoftonline.com/
- 身份验证使用我的凭据
- 重定向到
https://mysite-$environment.azurewebsites.net/.auth/login/aad/callback
- 错误
You do not have permission to view this directory or page.
的HTTPStatus401
重定向。
龙版
我有同样的服务计划下的Azure的3×Web应用程序 - 1个网站,2×的API。
我希望这些使用Azure AD进行身份验证。
所以,我使用Powershell创建了一个Azure AD App。
$app = @{
DisplayName = "azad-$environment-mysite"
IdentifierUris = @(
"https://mysite-$environment.azurewebsites.net",
"https://mysite-api-$environment.azurewebsites.net",
"https://mysite-api-2-$environment.azurewebsites.net"
)
HomePage = "https://mysite-$environment.azurewebsites.net"
ReplyUrls = @(
"https://mysite-$environment.azurewebsites.net",
"https://mysite-api-$environment.azurewebsites.net",
"https://mysite-api-2-$environment.azurewebsites.net"
)
AvailableToOtherTenants = $false
}
New-AzureRmADApplication @app
然后,使用ApplicationId
返回,我已经安装在Azure AD通过门户Web App > Authentication/Authorization
刀片。
这与在Azure AD server authentication, No permission to view directory问题上提出的问题类似。
你使用的是aspnet吗? Mvc Web API? – Thomas
@Thomas。对不起,我忘了那个细节。我正在使用ASP.NET Core/MVC6。 – Dennis