Azure 网站身份验证/授权

Azure Websites Authentication / Authorization

我正在使用 Azure 的新功能,无需编写任何代码即可为您的网站启用活动目录身份验证。 http://azure.microsoft.com/blog/2014/11/13/azure-websites-authentication-authorization/

但问题是我的 Web 应用程序还托管了一些 Web API,需要在没有任何身份验证的情况下调用它们。

有没有办法(一些属性?)让我可以在没有任何身份验证的情况下调用 Web APIs?

来自您引用的同一篇文章:

Current Limitations

There are some limitation to the current preview release of this feature:

...

With the current release the whole site is placed behind login the requirement.

Head less authentication/authorization for API scenarios or service to service scenarios are not currently supported.

所以,不,您不能匿名使用部分 API 或页面 - 所有页面和 API 都将受到 Azure Active Directory 的保护。

Tushar,我看到 Byron 在他的 post- 上也回答了你的问题,并建议创建另一个关于 API 的网站作为解决方法。但是,我建议您按照我们此处的示例分别为您的 Web 应用程序和 API 连接身份验证:https://github.com/AzureADSamples/WebApp-OpenIDConnect-DotNet, https://github.com/AzureADSamples/WebApp-WebAPI-OpenIDConnect-DotNet

如果您运行遇到任何问题,请告诉我。