Using UD with Azure modules

I’m currently working on standing up UD as a front end website for Azure Automation runbook execution and status info. I’ve tried a few different variations to keep my webserver connected to azure using Connect-AzAccount but i’ve run into various issues with session timeout and such. I’m curious if anyone else has done this yet and if so, how they implemented.

Some of the things I’ve done:

  • $Cache: variables and Connect-azaccount at start of page file that has Az commands used. This works decently, but session timeout causes you to have to reload page in order to be able to view data pulled from Azure or re-run buttons that perform Az actions.
  • Scheduled endpoint to run every x seconds to set all my $Cache: variables and check if connection is active, using Get-AzContext, if it isn’t connected it runs Connect-AzAccount. This has been less successful than the first option, hit and miss proper connectivity.
  • Setup a conditional before each Az command to check Get-AzContext and perform Connect-AzAccount. This has been a completely failure, causing a blank webpage for my site when I set it up.
1 Like

Self update on this. I found this documentation from Microsoft for setting the Az account as cross session use. I’ve set it in my test environment and it seems to be working well so far.

1 Like