Need to have publicHostNameConfiguration inm powershell template

Hi Team,

I am using powershell to add octopus extension in azure vm, though i am able to add it but i am unable to assign them in the deployment targets from PowerShell, because publicHostNameConfiguration is not acceptable in the PowerShell commands

It would be really helpful to add this command as this will reduce the level of manual work as we need to deploy extensions of 100’s of VM’s

I went to the Json method, it might not be suitable in, our case and i find the powershell very useful in adding the extension

I am using the following script

Login-AzureRmAccount -SubscriptionName “subscription”

$vmname=(Find-AzureRmResource -TagName ‘MachineType’ -TagValue Ocotpus).Name

$publicSettings = @{
OctopusServerUrl = “octopusurl”;
Environments = @(“envname”);
Roles = @(“app-server”, “web-server”);
CommunicationMode = “Listen”;
Port = 10933;
publicHostNameConfiguration= ComputerName
}

$privateSettings = @{“ApiKey” = “APIKey”}

foreach($name in $vmname){

Set-AzureRmVMExtension -ResourceGroupName “RG” -Location “Location” -VMName $name -Name “OctopusDeployWindowsTentacle” -Publisher “OctopusDeploy.Tentacle” -TypeHandlerVersion “2.0” -Settings $publicSettings -ProtectedSettings $privateSettings -ExtensionType “OctopusDeployWindowsTentacle”

}

Hi Chandra,

Thanks for getting in touch.

Using your script I was able to recreate the error you are getting.
The parameter names in $publicSettings hash are case sensitive. By setting the parameter name as PublicHostNameConfiguration the deployment succeeded. Also, the value of the PublicHostNameConfiguration parameter is a string and needs to be in quotes.

I hope this helps you get your VMs provisioned.

Regards
Ben

Thanks Benpearce,

It was a silly mistake from my end. Thanks for pointing me to the right direction.

I am able to add the extension with PublicHostNameConfiguration