Hello @t. sato
It is expected behavior for function keys to change each time you deploy your Azure Functions from Visual Studio Code using the Deploy to Function App command.
This is because the deployment process generates a new host key for the function app, which in turn invalidates any existing function keys. To prevent this from happening, you can manually manage your function keys in the Azure portal or by using the Azure Functions Core Tools.
This way, you can update your function code without overwriting or regenerating the existing function keys. Here are the general steps to manually manage your function keys:
- In the Azure portal, navigate to your function app and select the Functions blade.
- Select the function for which you want to manage keys.
- Select the Manage link for the function, and then select the Function keys tab.
- From here, you can add, edit, or delete function keys as needed. Alternatively, you can use the Azure Functions Core Tools to manage your function keys. Here's an example command to add a new function key:
func azure functionapp keys add --function-name --name --value
You can find more information on managing function keys in the Azure Functions documentation.
I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.