[Azure][PowerShell][ASM][12]ACL

$mySubscriptionName="运维环境"

Select-AzureSubscription -SubscriptionName $mySubscriptionName 

 

$myServiceName="云服务名称"

$myVMName="虚拟机名称"

$myEndPoint="终结点名称"

$myACL=New-AzureAclConfig

$myRemoteSubnet="x.x.x.x/32"

$myDescription="描述"

$myID=0

$myACL = Get-AzureVM -ServiceName $myServiceName -Name $myVMName | Get-AzureAclConfig -EndpointName $myEndPoint

$myNewACLs=

( "x.x.x.x/32","描述"),

( "x.x.x.x/32","描述"),

( "x.x.x.x/32","描述"),

( "x.x.x.x/32","描述"),

( "x.x.x.x/32","描述"),

( "x.x.x.x/32","描述")

foreach($myNewACL in $myNewACLs)

{

Set-AzureAclConfig -AddRule -ACL $myACL -Order $myID -Action Permit -RemoteSubnet $myNewACL[0] -Description $myNewACL[1]

$myID=$myID + 1

}

#$remoteSubnet="172.0.0.0/8"

#$description="20"

# Set-AzureAclConfig -AddRule -ACL $myACL -Order $myID -Action Permit -RemoteSubnet $myRemoteSubnet -Description $myDescription

Get-AzureVM -ServiceName $myServiceName -Name $myVMName | Set-AzureEndpoint -ACL $myACL -Name $myEndPoint | Update-AzureVM

posted @ 2017-05-26 17:33  wuzhenzhou  阅读(113)  评论(0编辑  收藏  举报