Impacted one user so far, but could impact many. Workaround should be viable in most cases
Version
2022.1.2364, 2022.2.5111
Latest Version
I could reproduce the problem in the latest build
What happened?
If a 'Deployment Slot' is selected for an Azure Web App deployment target, it's impossible to reset to the default value (blank) via UI.
If a deployment slot is removed (so that only Production remains), I would expect to be able to reset this to default or be able to select the Production slot.
Reproduction
Create a new Azure Web App and connect it as a deployment target in Octopus
Add a deployment slot to the Web App in Azure (Web App > Deployment Slots > Add Slot)
Set the Azure Web App Slot to the newly created one in Octopus and save
Reload the page and attempt to update the slot
Remove the slot in Azure, reload the page, and attempt to reset the slot
You can force the deployment slot to be reset via API call by changing the Machine.Endpoint.WebAppSlotName.
The following API script should perform this action. When running this script, be sure to read and fully understand it before doing so.
Substitute your own Octopus URL, API key, Space name, and Machine Id. Note the Machine ID can be found in the URL when in the Octopus Portal and viewing the machine under Infrastructure > Deployment Targets > (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)
Team
Severity
Impacted one user so far, but could impact many. Workaround should be viable in most cases
Version
2022.1.2364, 2022.2.5111
Latest Version
I could reproduce the problem in the latest build
What happened?
If a 'Deployment Slot' is selected for an Azure Web App deployment target, it's impossible to reset to the default value (blank) via UI.
If a deployment slot is removed (so that only Production remains), I would expect to be able to reset this to default or be able to select the Production slot.
Reproduction
Slot will remain set to the one selected.
Error and Stacktrace
No response
More Information
Original issue - https://help.octopus.com/t/unable-to-remove-azure-web-app-slot-value/28037
Workaround
You can force the deployment slot to be reset via API call by changing the Machine.Endpoint.WebAppSlotName.
The following API script should perform this action. When running this script, be sure to read and fully understand it before doing so.
Substitute your own Octopus URL, API key, Space name, and Machine Id. Note the Machine ID can be found in the URL when in the Octopus Portal and viewing the machine under Infrastructure > Deployment Targets > (web app target)