Unable to remove "Azure Web App Slot" value

Once a Azure Web App Slot has been saved to a Azure Web App target, it’s not possible to remove and save.
V2022.1 (Build 2364)

Hey @seanl,

Thanks for posting your issue!

I’m able to reproduce this behavior in my test environment, so I can confirm this is a bug. I’ll get a GitHub issue created for it and post back here once I’ve done that.

In the meantime, I have an API script you can run that should hopefully get the slot reset to default if it’s blocking you. Please test the script prior to running it and understand what it does. If you substitute your own Octopus URL, API key, Space name, and Machine Id, the following script should help. Note you can find the Machine ID in the URL when you’re in the Octopus Portal and viewing the machine under Infrastructure > Deployment Targets > (your web app target).

# Define working variables
$octopusURL = "https://YOUR-OCTO-URL"
$octopusAPIKey = "API-####"
$header = @{ "X-Octopus-ApiKey" = $octopusAPIKey }
$spaceName = "YOUR-SPACE"
$machineId = "Machines-####"

# Get space
$space = (Invoke-RestMethod -Method Get -Uri "$octopusURL/api/spaces/all" -Headers $header) | Where-Object {$_.Name -eq $spaceName}

# Get machine
$machine = (Invoke-RestMethod -Method Get -Uri "$octopusURL/api/$($space.Id)/machines/$machineId" -Headers $header)

# Reset the Web App Slot
$machine.Endpoint.WebAppSlotName = ""

# Convert machine to JSON
$machine = $machine | ConvertTo-Json -Depth 100

# PUT the updated machine JSON with reset Web App Slot to the existing machine ID
Invoke-RestMethod -Method "Put" -Uri "$octopusURL/api/$($space.Id)/machines/$machineId" -Headers $header -Body ($machine)

I hope that’s helpful and let me know if you have any further questions.


Hey @seanl,

I’ve created a GitHub issue to cover this bug, and you can find it here: Once an Azure Web App Slot is picked for an Azure Web App deployment target, it isn't possible to remove it via the UI · Issue #7588 · OctopusDeploy/Issues · GitHub

You should be able to subscribe to that issue to track it for any changes our developers make regarding this.

I hope that’s helpful, and let me know if you need anything else!


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