How to stop a functionapp in a slot using azure CLI
Asked Answered
F

2

5

I would like to issue a command using Azure CLI that stops a functions app in a particular deployment slot only.

The Azure CLI 2.0 documentation Azure CLI 2.0 documentation lists the command:

az functionapp stop --name
                    --resource-group

But it is not clear to me how to stop not the "main" app, but the app in a particular deployment slot.

In my case the slot is called dev and the app is called myapp. I've tried:

az functionapp stop --name=dev --resource-group=myresourcegroup
The Resource 'Microsoft.Web/sites/dev' under resource group myresourcegroup' was not found.

az functionapp stop --name=myapp/dev --resource-group=myresourcegroup
az functionapp stop --name='myapp/dev' --resource-group=myresourcegroup
Operation failed with status: 'Not Found'. Details: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/long-guid/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myapp%2Fdev/start?api-version=2016-08-01

I'm able to stop the main app no problem. And when I issue the command to stop the main app, the app in the deployment slot does not stop (as I can see by checking in the portal GUI).

So, how can I stop the app in the deployment slot from the command line?

Fain answered 22/1, 2018 at 13:48 Comment(1)
I think it's not supported yet, there is a github issuePatrizius
M
5

You could use az resource invoke-action --action stop --ids to stop funtion app slot

For example:

az resource invoke-action --action stop --ids  /subscriptions/*********/resourceGroups/shuiResourceGroup/providers/Microsoft.Web/sites/shuiFunctionApp/slots/shuiSlot
Mucus answered 23/1, 2018 at 1:44 Comment(0)
M
1

az functionapp stop --name MyFunctionApp --resource-group MyResourceGroup --slot yourslotname

This has been added since the question and the accepted answer.

Reference Doc

Magnetochemistry answered 2/8, 2022 at 20:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.