Seeting Octopus Extension in Azure with private IP

Hello,

I have a problem with configuring public settings to reference a private ip of a vm in azure. Following instruction available @ https://octopus.com/docs/infrastructure/windows-targets/azure-virtual-machines/via-powershell
What should i input into the CustomPublicHostName parameter.

$vm = Get-AzureRmVm -Name $azVmName -ResourceGroupName $azResourceGroupName
$nic = Get-AzureRmNetworkInterface -ResourceGroupName $azResourceGroupName | ? { $.VirtualMachine.Id -eq $vm.Id -and $.Primary }

$publicSettings = @{
OctopusServerUrl = “$octopusUrl”;
Environments = @("$octopusEnv");
Roles = @("$octopusRoles");
CommunicationMode = “Listen”;
Port = 10933;
PublicHostNameConfiguration = ‘Custom’
CustomPublicHostName = “[reference(variables(’$nic’),‘2016-09-01’).ipConfigurations[0].properties.privateIPAddress]”
}

Found solution, as below:

$vm = Get-AzureRmVm -Name $azVmName -ResourceGroupName $azResourceGroupName
$nic = Get-AzureRmNetworkInterface -ResourceGroupName $azResourceGroupName | ? { $.VirtualMachine.Id -eq $vm.Id -and $.Primary }

$publicSettings = @{
OctopusServerUrl = “$octopusUrl”;
Environments = @("$octopusEnv");
Roles = @("$octopusRoles");
CommunicationMode = “Listen”;
Port = 10933;
PublicHostNameConfiguration = ‘Custom’
CustomPublicHostName = $nic.IpConfigurations.PrivateIpAddress

Hi,

Thanks for getting in touch! That’s great to hear you’ve found the solution, and thank you for taking the time to post it to help others in the future. Don’t hesitate to reach out if you have any further questions or concerns moving forward. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.