允许/拒绝用户在Azure应用程序服务中使用web.config
我有一个应用程序服务,有3个虚拟路径,如下所示允许/拒绝用户在Azure应用程序服务中使用web.config,azure,azure-active-directory,web-config,azure-web-app-service,Azure,Azure Active Directory,Web Config,Azure Web App Service,我有一个应用程序服务,有3个虚拟路径,如下所示 Virtual path Physical path Type / site\wwwroot Application /app2 site\wwwroot\app2 Application /app3 site\w
Virtual path Physical path Type
/ site\wwwroot Application
/app2 site\wwwroot\app2 Application
/app3 site\wwwroot\app3 Application
如何使用web.config控制使用Azure安全组访问我的网站?我有3个安全组,我想允许如下访问
允许sg1
访问我的根/
允许sg2
访问我的根目录&/app2
允许sg3
访问我的根目录&/app3
在我的on-prem-IIS框中,我可以执行如下操作来控制访问
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Windows"/>
<authorization>
<allow roles="GLOBAL\sg1"/>
<deny users="*"/>
</authorization>
</system.web>
<location path="app2">
<system.web>
<authorization>
<allow roles="Global\sg1"/>
<allow roles="Global\sg2"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="app3">
<system.web>
<authorization>
<allow roles="Global\sg1"/>
<allow roles="Global\sg3"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>
请帮助:(
我可以在Azure应用程序服务中复制此内容吗
不可以,因为您描述的是Active Directory行为。应用程序服务不与AD集成
下一个最好的方法是Azure AD身份验证,但这需要更改代码,并且最终看起来完全不同:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="app2">
<system.web>
<customErrors mode="Off"/>
<authentication mode="Windows"/>
<authorization>
<allow roles="GLOBAL\sg1"/>
<allow roles="GLOBAL\sg2"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>