Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neil-sabol/304af57580ca812c61979294b5f40908 to your computer and use it in GitHub Desktop.
Save neil-sabol/304af57580ca812c61979294b5f40908 to your computer and use it in GitHub Desktop.
See https://blog.neilsabol.site/post/importing-duo-psmodule-mfa-powershell-module-azure-automation. This snippet demonstrates securely providing Duo integration details to the Duo-PSModule in Azure Automation using encrypted Automation Variables and forcing a directory synchronization cycle for all Duo users.
# Get Duo integration details from Automation Variables
$duoiKey = Get-AutomationVariable -Name MyDuoiKey
$duosKey = Get-AutomationVariable -Name MyDuosKey
$duoApiHost = Get-AutomationVariable -Name MyDuoHostname
$duoDirID = Get-AutomationVariable -Name MyDuoDirectoryID
# Build the $DuoOrgs hashtable from retrieved Automation Variables
[string]$DuoDefaultOrg = "Personal"
[Hashtable]$DuoOrgs = @{
Personal = [Hashtable]@{
iKey = [string]$duoiKey
sKey = [string]$duosKey
apiHost = [string]$duoApiHost
directory_key = [string]$duoDirID
}}
# Force a Duo directory synchronization for all existing users
duoGetUser | %{ duoSyncUser -username $_.username }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment