Add AzureCloudService Tentacle to Environment


I’m attempting to add an azure cloud service tentacle to an environment in Octopus.

The payload I’m submitting is:
“EnvironmentIDs”: [
“Name”: “My cloud service”,
“IsDisabled”: false,
“Endpoint”: {
“cloudServiceName”: “my-cloud-service-api”,
“slot”: “Staging”,
“CommunicationStyle”: “AzureCloudService”,
“swapIfPossible”: “False”,
“accountId”: “Accounts-20”,
“storageAccountName”: “mystorageaccountsg”,
“useCurrentInstanceCount”: “True”,
“Links”: {

"Links":  {

"Status":  "Unknown",
"Roles":  [


I get the following error:
[Invoke-RestMethod] The remote server returned an error: (400) Bad Request.

Any idea what I’m missing from the submitted payload?

The submission is to:
Invoke-RestMethod -Method Post -Uri ("{0}/api/machines" -f $OctopusURI) -Headers @{‘X-Octopus-ApiKey’ = $OctopusAPIKey} -Body $body

Kind Regards and thanks in advance.
Jagwinder Padda

A little odd, but is it possible that some properties are case-sensitive? When I changed
AccountId, CloudServiceName and StorageAccountName to have an upper-case starting letter, it worked.
accountId, cloudServiceName and storageAccountName = FAIL.
AccountId, CloudServiceName and StorageAccountName = PASS.