Thursday, 8 September 2022

Python - Get invocation id in azure function

After finding the right part in the documentation it was surprisingly easy:

def main(mytimer: func.TimerRequest, context: func.Context) -> None:
    try: 
        invocation_id = context.invocation_id
        # Function continues here. 

    except Exception as e:
        logging.error("Main program failed with error: " + str(e)) 

Be aware that this solution only works if func.Context is assigned to context. Using any other name than context results in errors for me -.- 


from: https://stackoverflow.com/questions/64521460/get-current-invocationid-or-operation-id

No comments:

Post a Comment

Python - Get invocation id in azure function

After finding the  right part in the documentation  it was surprisingly easy: def main ( mytimer: func.TimerRequest, context: func.Context ...