Created
February 6, 2021 18:16
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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