如何从代码中为azure云服务创建访问控制规则?

时间:2016-11-21 18:28:42

标签: azure azure-cloud-services

我的云服务中有一个类似于下面的网络访问控制列表。如何以编程方式而不是从配置文件中配置?

其中一些IP地址可能会发生变化。我想从域名解析IP地址并添加配置:

<NetworkConfiguration>
<AccessControls>
  <AccessControl name="security">
    <Rule action="permit" description="Allow access from A" order="100" remoteSubnet="xxx.xxx.xxx.xxx/32" />
    <Rule action="permit" description="Allow access from B" order="200" remoteSubnet="xxx.xxx.xxx.xxx/32" />
    <Rule action="permit" description="Allow access from C" order="300" remoteSubnet="xxx.xxx.xxx.xxx/32" />
    <Rule action="deny" description="Deny access to everyone else" order="400" remoteSubnet="0.0.0.0/0" />
  </AccessControl>
</AccessControls>

1 个答案:

答案 0 :(得分:0)

您可以创建单独的角色或Azure功能,以生成新配置并通过REST更新服务:https://msdn.microsoft.com/en-us/library/azure/ee460812.aspx

相关问题