The Resource 'Microsoft.Web/serverFarms/WestUSPlan' under resource group 'my-resource-group' was not found

Zach Howell 20 Reputation points
2024-04-02T20:23:56.9233333+00:00

I'm trying to bind a function to a resource group / consumption plan with:
az functionapp config appsettings set --resource-group my-resource-group --name my-function --settings WEBSITE_HTTPSCALEV2_ENABLED=1 FUNCTIONS_EXTENSION_VERSION=~4

I created the resource group with:
az group create --name my-resource-group --location westus --tags benchmark=yadayadamanytags

I get the error:
The Resource 'Microsoft.Web/serverFarms/WestUSPlan' under resource group 'my-resource-group' was not found when running the functionapp config appsettings set command.

The function was created with command:
az functionapp create --storage-account my-storage-account --resource-group my-resource-group --name my-function --functions-version 4 --consumption-plan-location westus --runtime java --runtime-version 17.0 --os-type Windows

I actually create & delete these daily, which might be slightly odd, but it means I know that these two commands worked until yesterday & have not been working today.

What's going on? I can't find much information about the 'Microsoft.Web/serverFarms/WestUSPlan' and why it might not have been created properly. A couple of stackoverflow questions mention the resource group mihgt not be in the same region, but here it's quite clear that both are in westus.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,281 questions
{count} votes

Accepted answer
  1. VenkateshDodda-MSFT 18,281 Reputation points Microsoft Employee
    2024-04-18T05:34:02.6733333+00:00

    @Zach Howell Thanks for your patience on this.

    I am summarizing our offline conversation and posting the same as an answer for the benefit of other community members.

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer.

    Issue:

    Op(original Poster) was trying to create and update the app settings of the function using the above shared cmdlets and while updating the app setting it fails with the below error message "The Resource 'Microsoft.Web/serverFarms/WestUSPlan' under resource group 'my-resource-group' was not found"

    Work Around/Mitigations Suggested:

    Reviewed Op PowerShell Script and requested them to add another condition to check whether the function app is present or not before calling the az functionapp config appsettings set to update the function app appsettings.

    Op has modified the script and confirmed that it is working fine.


    I hope this helps!

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Zach Howell 20 Reputation points
    2024-04-17T16:48:05.5733333+00:00

    This turned out to be a race condition where I was calling az functionapp config appsettings set too quickly after calling az functionapp create. Waiting a bit longer in-between fixed the problem.

    The error message The Resource 'Microsoft.Web/serverFarms/WestUSPlan' under resource group 'my-resource-group' was not found referred to the app service plan, which was created for the function given I passed --consumption-plan-location westus.

    Thanks to Venkatesh for the help, and in fact setting a meeting to do some debugging! Above & beyond.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more