Created
November 4, 2018 12:37
-
-
Save bdanse/c2b8c3c509de78434e16f443189b19f8 to your computer and use it in GitHub Desktop.
Example for creating Automation PSCredential
This file contains 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
#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