How to setuo unique id for function app

Nuwan Wickramanayaka 81 Reputation points
2022-09-27T15:21:50.607+00:00

I am working on simple AZ function app ( only one function) and it is inserting and updating a common database table. There will be a plan to deploy the AZ function on multiple AZ resource groups. All instance of the function will access common database and table. Then I do need to know the which instance is updating the data base.

I can do it by using a configuration and setup an unique id for each function instance. I want to know is there any other way round to do this ?

Thanks
Nuwan

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

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,446 Reputation points
    2022-09-28T08:54:32.84+00:00

    Hi @Nuwan Wickramanayaka ,

    Thanks for posting this question in Q&A forum.

    As you mentioned, "AzureFunctionsWebHost__hostId" app setting can be added and a unique guid value can be provided to identify the function instance. Another way is to create and concatenate the guid value with the invocation id through code. Here is an example: https://stackoverflow.com/questions/64114545/how-to-get-unique-instance-id-of-azure-function-in-python

    Hope this helps! Feel free to reach out to me if you have any queries or concerns.

    0 comments No comments