skip to Main Content

Using this command:

az staticwebapp functions link --function-resource-id "/subscriptions/[sub-id]/resourceGroups/[resource-group-name]/providers/Microsoft.Web/sites/[func-name]/slots/[slot-name]" -n [swa-name] -g [swa-rg-name] --environment-name "[env-name]" --force

I get error:

ERROR: --function-resource-id must specify a function resource ID. To get resource ID, use the following commmand, inserting the function group/name as needed: 
az functionapp show --resource-group "[FUNCTION_RESOURCE_GROUP]" --name "[FUNCTION_NAME]" --query id 

How do I specify the Azure Function deployment slot?

2

Answers


  1. You should be able to use the generic az staticwebapp backends link command. It should accept any valid resourceId

    az staticwebapp backends link `
      --backend-resource-id <function app slot resource id>`
      --name <static website name>`
      --resource-group <resource group name>
    
    Login or Signup to reply.
  2. In the resource id place you have to keep resource id of function app as below:

    $x=az functionapp show --resource-group "v-rbojja" --name "rith8976" --query id
    

    Then you can use below commad:

    az staticwebapp functions link --function-resource-id $x -n "rith98webapp" -g "v-rbojja" --environment-name "rith8976-rithwik" --force
    

    You can also use backend command as @Thomas mentioned :

    az staticwebapp backends link -n rith98webapp -g "rg" --backend-resource-id $x --backend-region "East US"
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search