Azure에서 실행되는 Service Fabric 애플리케이션은 Azure 부하 분산 장치 뒤에 있습니다. 이 샘플 Azure PowerShell 스크립트는 Service Fabric 애플리케이션이 외부 클라이언트와 통신할 수 있도록 Azure 부하 분산 장치에서 포트를 엽니다. 필요에 따라 매개 변수를 사용자 지정합니다. 클러스터가 네트워크 보안 그룹에 있는 경우 인바운드 트래픽을 허용하는 인바운드 네트워크 보안 그룹 규칙도 추가 합니다.
비고
Azure Az PowerShell 모듈을 사용하여 Azure와 상호 작용하는 것이 좋습니다. 시작하려면 Azure PowerShell 설치를 참조하세요. Az PowerShell 모듈로 마이그레이션하는 방법에 대한 자세한 내용은 Azure PowerShell을 AzureRM에서 Azure로 마이그레이션을 참조하세요.
샘플 스크립트
# Variables
$probename = "AppPortProbe6"
$rulename="AppPortLBRule6"
$RGname="mysftestclustergroup"
$port=8303
$subscriptionID = 'subscription ID'
# Login and select your subscription
Connect-AzAccount
Get-AzSubscription -SubscriptionId $subscriptionID | Select-AzSubscription
# Get the load balancer resource
$resource = Get-AzResource | Where {$_.ResourceGroupName –eq $RGname -and $_.ResourceType -eq "Microsoft.Network/loadBalancers"}
$slb = Get-AzLoadBalancer -Name $resource.Name -ResourceGroupName $RGname
# Add a new probe configuration to the load balancer
$slb | Add-AzLoadBalancerProbeConfig -Name $probename -Protocol Tcp -Port $port -IntervalInSeconds 15 -ProbeCount 2
# Add rule configuration to the load balancer
$probe = Get-AzLoadBalancerProbeConfig -Name $probename -LoadBalancer $slb
$slb | Add-AzLoadBalancerRuleConfig -Name $rulename -BackendAddressPool $slb.BackendAddressPools[0] -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -Probe $probe -Protocol Tcp -FrontendPort $port -BackendPort $port
# Set the goal state for the load balancer
$slb | Set-AzLoadBalancer
스크립트 설명
이 스크립트는 다음 명령을 사용합니다. 표에 있는 각 명령은 명령에 해당하는 문서에 연결됩니다.
| Command | 비고 |
|---|---|
| Get-AzResource | Azure 리소스를 가져옵니다. |
| Get-AzLoadBalancer | Azure 부하 분산 장치를 가져옵니다. |
| Add-AzLoadBalancerProbeConfig | Load Balancer에 프로브 구성을 추가합니다. |
| Get-AzLoadBalancerProbeConfig | Load Balancer에 대한 프로브 구성을 가져옵니다. |
| Add-AzLoadBalancerRuleConfig | Load Balancer에 규칙 구성을 추가합니다. |
| Set-AzLoadBalancer | 부하 분산 장치의 목표 상태를 설정합니다. |
다음 단계
Azure PowerShell 모듈에 대한 자세한 내용은 Azure PowerShell 설명서를 참조하세요.
Azure Service Fabric에 대한 추가 PowerShell 샘플은 Azure PowerShell 샘플에서 찾을 수 있습니다.