Azure function App 'code' parameter changes value.

Richard Scannell 426 Reputation points
2022-11-15T10:23:30.077+00:00

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

myFunc.azurewebsites.net/api/myFunc?code=codeval1

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:

myFunc.azurewebsites.net/api/myFunc?code=codevalue22

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

**Update

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.
5,911 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruno Lucas 4,436 Reputation points MVP
    2022-11-16T03:12:10.93+00:00

    Hi @Richard Scannell

    How are you storing the key? (link)
    260686-image.png

    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"
    260781-image.png

    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 426 Reputation points
    2022-11-16T09:22:22.57+00:00

    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 426 Reputation points
    2022-11-16T11:42:54.493+00:00

    Hi @Bruno Lucas

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


  3. Richard Scannell 426 Reputation points
    2022-11-17T09:14:42.247+00:00

    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.