Skip to content

Instantly share code, notes, and snippets.

@bdanse
bdanse / InstallVSCode.txt
Last active August 14, 2019 18:30
Install vscode
# Install boxstarter
# . { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; Get-Boxstarter -Force
# Install-BoxstarterPackage -PackageName gisturi
Update-ExecutionPolicy Unrestricted
Set-ExplorerOptions -showFileExtensions
Disable-InternetExplorerESC
Install-WindowsUpdate -AcceptEula
Install-Module -Name Az -AllowClobber -Scope AllUsers
# Standard method of retrieving credentials
Get-AutomationPSCredential -Name Name1
# Alternative method with keyvault specified
Get-KeyvaultPSCredential -name Name1 -VaultName mykeyvault
# Alternative method without keyvault specified
# Make sure there is an Automation variable created named PSCredentialKeyVault
Get-KeyvaultPSCredential -name Name1
@bdanse
bdanse / SetKeyvaultPSCredentialExample.ps1
Last active November 4, 2018 13:06
SetKeyvaultPSCredentialExample
#Single keyvault PSCredential secret
Set-KeyvaultPSCredential -Name 'Name1' -UserName 'domain\user2' -VaultName mykeyvault
#Create multiple keyvault PSCredential secrets based on a hashtable
$hash = @(
@{
Name = 'Name1'
UserName = 'domain\User1'
},
@{
@bdanse
bdanse / CreateAutomationPSCredential.ps1
Created November 4, 2018 12:37
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