Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mano8/1260da0c4c3a7be2bb2238541c83018c to your computer and use it in GitHub Desktop.
Save mano8/1260da0c4c3a7be2bb2238541c83018c to your computer and use it in GitHub Desktop.
Example for creating Automation PSCredential
#Create a secure string for the password
$SecureStringPassword = ConvertTo-SecureString "SuperSecretPassw0rd" -AsPlainText -Force
#Create a PSCredential object
$PSCredential = New-Object System.Management.Automation.PSCredential('domain\myusername', $SecureStringPassword)
#Write PSCredential object to an Azure Automation account
New-AzureRmAutomationCredential -Name 'MyCredentialAssetName' -Value $PSCredential
#Retrieve PSCredential object from within a runbook of DSC compilation job
Get-AutomationPSCredential -Name 'MyCredentialAssetName'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment