2010-08-19 96 views

回答

1

在Azure中我还没有亲自做过这个呢,但你有没有尝试过使用通过the system.webServer/security/ipSecurity configuration element IIS7的IP安全功能?

+0

感谢您的及时答复,德鲁。 该帖子的版主声明“ipSecurity目前无法在Windows Azure上运行。” http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/c197f725-503e-4a44-abce-ea99c741758d/ 而使用配置文件不会为我工作,因为我想添加/删除IP范围而无需重新部署整个软件包! 这是在流量到达应用程序之前应该运行的检查。 我不能相信这样一个重要的功能被遗漏,因为我看不到一个LOB应用程序不想限制流量! Luc – Azure 2010-08-19 13:45:46

+0

啊,对不起,在提出这个建议之前我应该​​做更多的调查。至少在这里是为了后人的缘故,希望能帮助看这个话题的人理解它不是*选项。 – 2010-08-20 14:49:04

3

从SDK(现在V1.4)的V1.3开始,可以使用完整的IIS支持和启动任务来帮助解决此问题。

我的博客上讲述这个http://blog.bareweb.eu/2011/04/restricting-access-by-ip-in-azure-web-role-v1-4/

您可以在web.config中使用IP安全,但你也必须做的关于安装IPSec模块到IIS一些工作。

问候 安迪

+0

现在这个答案已经过时了,请参阅下面Henri的回答,以获得更新和更简单的解决方案。 – 2016-03-01 04:30:44

2

由于Azure的SDK 2.4出现了使用访问控制列表(ACL)为您的云服务应用IP限制的可能性。我写这个博客文章:http://www.henrihietala.fi/apply-ip-restrictions-for-azure-cloud-service/

只需添加ACL在ServiceConfiguration.Cloud.cscfg

<?xml version="1.0" encoding="utf-8"?> 
<ServiceConfiguration serviceName="MyWebRole.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4"> 
    <Role name="MyWebRole"> 
    ... 
    </Role> 
    <NetworkConfiguration> 
    <AccessControls> 
     <AccessControl name="ipRestrictions"> 
     <Rule action="permit" description="allowed-edu" order="100" remoteSubnet="137.133.228.111/32" /> 
     <Rule action="permit" description="allowed-test" order="101" remoteSubnet="168.61.66.2/32" /> 
     <Rule action="permit" description="allowed-prod" order="102" remoteSubnet="168.61.66.131/32" /> 
     <Rule action="deny" description="Others" order="800" remoteSubnet="0.0.0.0/0" /> 
     </AccessControl> 
    </AccessControls> 
    <EndpointAcls> 
     <EndpointAcl role="MyWebRole" endPoint="Endpoint1" accessControl="ipRestrictions" /> 
     <EndpointAcl role="MyWebRole" endPoint="HttpsIn" accessControl="ipRestrictions" /> 
    </EndpointAcls> 
    </NetworkConfiguration> 
</ServiceConfiguration> 

小心规则属性。如果您指定了相同的订单号或说明两次或者remoteSubnet中的IP地址不正确,则您的部署将失败。

+0

你有没有找到更多的官方文档?我想知道这是什么预期的结果(即状态返回) – 2016-03-01 04:31:42