[Azure][PowerShell][ASM][10]Endpoint

$mySubscriptionName=""
Select-AzureSubscription -SubscriptionName $mySubscriptionName

$myServiceName = ""
$myVMName = ""

$myNewVMEndpoints =
("endpointname","tcp","8005","8005"),
("endpointname","tcp","8000","8000")

$myVM = Get-AzureVM -ServiceName $myServiceName -Name $myVMName

foreach ($myEndpointConfig in $myNewVMEndpoints)
{
$myVM | Add-AzureEndpoint -Name $myEndpointConfig[0] -Protocol $myEndpointConfig[1] -PublicPort $myEndpointConfig[2] -LocalPort $myEndpointConfig[3]
}

$myVM | Update-AzureVM

# 批量导入

Import-Csv '<CSVFilePath>' | foreach {Get-AzureVM -ServiceName $_.ServiceName -Name $_.VMname | Add-AzureEndpoint -Protocol $_.Protocol -LocalPort $_.LocalPort -PublicPort $_.PublicPort -Name $_.PortName | Update-AzureVM}

Import-Csv '<CSVFilePath>' | foreach {Get-AzureVM -ServiceName $_.ServiceName -Name $_.VMname | Add-AzureEndpoint -Protocol $_.Protocol -LocalPort $_.LocalPort -PublicPort $_.PublicPort -Name $_.PortName -ProbePort $_.ProbePort -ProbeProtocol $_.ProbeProtocol -LBSetName $_.LBSetName -ProbePath $_.ProbePath| Update-AzureVM}

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