Skip to content

Instantly share code, notes, and snippets.

@alistair
Created August 11, 2013 21:28
Show Gist options
  • Save alistair/6206923 to your computer and use it in GitHub Desktop.
Save alistair/6206923 to your computer and use it in GitHub Desktop.
"Secure" ( by ip address) a public Endpoint at the load balancer
#Cloud Services which communicate with target
$sourceServices = @( 'source1', 'source2' )
#The thing being communicated with
$targetServices = @( 'target1' )
#name of public endpoint
$endpointName = 'eventstore'
$lbSetName = '$myendpoint-80'
$order = 0
Import-AzurePublishSettingsFile credentials.publishsettings
Set-AzureSubscription -SubscriptionName REPLACE -CurrentStorageAccount REPLACE
$acl = New-AzureAclConfig
Set-AzureAclConfig -ACL $acl -AddRule Permit "My.Work.Net.Work/32" -Description "Home" -Order $order
$order += 1
foreach($sourceService in $sourceServices)
{
$Vip = $null
$Vip = (Get-AzureDeployment -ServiceName $sourceService).RoleInstanceList[0].InstanceEndpoints[0].Vip
if ($Vip -ne $null) {
Set-AzureAclConfig -ACL $acl -AddRule Permit "$Vip/32" -Description $sourceService -Order $order
$order+=1
}
}
foreach($targetService in $targetServices)
{
$deployments = Get-AzureService -ServiceName $targetService | Get-AzureDeployment
# ProbePort 1113 is the event store defalt tcp-port
Set-AzureLoadBalancedEndpoint -ServiceName $targetService -LBSetName $lbSetName -ACL $acl -ProbePort 1113 -ProbeProtocolTCP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment