Azure function App 'code' parameter changes value.

Richard Scannell 321 Reputation points

I am developing an HTTP triggered Azure function app using Visual Studio 2022 and publishing it with a Zip deploy.pubxml.

When I started, the function url returned by Azure's 'Get Function Url' button is

After a few stops, starts, restarts , refreshes, new Zip Deploys, & deployments from VS2022 of the Azure Function , the 'Get Function Url' value changes the value of the code parameter as follows:

I need to keep the 'code' parameter value as codeval1, because an earlier version of the function exists & this is the url which has been deployed to a number of sites as webhooks. So I need to know what happened

Does anyone know what action might change 'code' from being set to codeval1 to being set to codevalue22?
Can you recommend a process to ensure that the 'code' parameter stays the same?
How is the 'code' value generated & stored?

Thanks in advance, Richard


Further digging shows this parameter to be the 'default' parameter in the Function Keys side menu option. But its greyed out. Is there a way to edit the default value ?

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

Accepted answer
  1. Bruno Lucas 4,421 Reputation points MVP

    Hi @Richard Scannell

    How are you storing the key? (link)

    Never tried file system but I assume that may be affected by deployments depending how you deploy

    if you use storage, it should not change with deployment, only if you force renew clicking "renew key"

    Regarding deployment, you need to adopt a procedure that will not affect the key, like deleting the key from the storage or change the azure function setting that point it to the storage where the key is

    Regarding: "Further digging shows this parameter to be the 'default' parameter in the Function Keys side menu option. But its greyed out. Is there a way to edit the default value ?"

    You can't edit but you can renew clicking "renew key value". that is stored in a blob but even if there is a way to edit that in the blob, sounds like a bad idea. probably unsupported.

    Case that information helps, don't forget to vote or mark as Answer to help the community. Cheers!

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Richard Scannell 321 Reputation points

    HI @Bruno Lucas

    Thanks for your helpful reply

    I used the default method, as you showed in the HttpTrigger1 function example, underneath ‘Function Keys’. I have tried replicating the problem in a number of ways, but, the function key value has remained the same, in all the cases I have tested.

    It sounds like alternative methods ( eg key vault. ) might offer more flexibility in future, if I did need to reset to a previous value .

    I still don't know why the function key changed in the earlier deployment. I don't think I clicked the 'renew key value', which is why I was surprised that the key did change & why I posted this.

    Thank you for the confirmation about not being able to manually reset the default value. This is understandable, but makes it more important for me to get to the bottom of why the code changed.

    Do you have any other ideas about what might force this to change?

    Thanks again

  2. Richard Scannell 321 Reputation points

    Hi @Bruno Lucas

    Deployment was from a Visual Studio 22 Publish using a zip Deploy.pubxml file

  3. Richard Scannell 321 Reputation points

    Hi @Bruno Lucas . Thanks for looking . My attempts to deliberately break it to come up with some possibilities have all failed.

    0 comments No comments