问题
I do ci/cd to Cloud Service(classic) with azure devops. I have steps like start or stop and swap slots in this Cloud Service. I thought I can use PowerShell for these goals.
In the beginning, I tried Azure PowerShell job. Unfortunately, I have not found the required commands in Az and azureRM modules.
So I decided to use just PowerShell job, where I install the Azure module and I want to use these commands Start-AzureService
and Stop-AzureService
. Is it the right way? Or is there something better?
回答1:
Yes, in principle that would be true, however you can use the ARM proxy provider (Microsoft.ClassicCompute
) for that:
Invoke-AzResourceAction -ResourceGroupName $resourceGroup `
-ResourceType 'Microsoft.ClassicCompute/domainNames/slots' `
-ResourceName $cloudService/$slotName `
-ApiVersion '2018-06-01' -Action 'Stop' -Force
I don't have a working cloud service to test this, but should be close enough
来源:https://stackoverflow.com/questions/59966577/is-it-possible-to-do-swap-start-stop-slots-in-cloud-service-classic-on-azure