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 the cert | |
New-SelfSignedCertificate -DnsName 'foo.azurewebsites.net' -CertStoreLocation cert:\CurrentUser\My -KeyAlgorithm RSA -KeyLength 2048 -KeyExportPolicy Exportable #-KeyUsage DigitalSignature,nonRepudiation,keyEncipherment | |
#Look for the cert | |
dir Cert:\CurrentUser\My | |
#Export the cert to a PFX file | |
$mypwd = ConvertTo-SecureString -String "WhoFedTheDogCorn?" -Force –AsPlainText | |
dir Cert:\CurrentUser\My | Where Subject -EQ 'CN=foo.azurewebsites.net' | Export-PfxCertificate -ChainOption BuildChain -Password $mypwd -FilePath E:\Scratch\fooCert.pfx |
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
### Authenticate to AAD | |
Login-AzureRmAccount | |
### There are two commands for this, from two sources | |
Get-Command Get-AzureADApplication #module: AzureAD 1.1.23.0 | |
Get-Command Get-AzureRmADApplication #module: AzureRM.Resources 1.0.3 | |
Get-AzureRmADApplication -DisplayNameStartWith fooApp | |
<# |
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
### Warm up by looking for commands | |
get-command *AzureRmKeyVault* | |
get-command *AzureKeyVault* | |
### Does the Vault exist already? | |
Get-AzureKeyVaultKey -VaultName cmartKeyVault01 -Name TestKey | |
### Does the ResourceGroupName exist yet? | |
Get-AzureRmResourceGroup | select ResourceGroupName |
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
### Load ADAL | |
Add-Type -Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" | |
# Set AAD client ID for the client app | |
$clientId = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" | |
$resourceAppIdURI = "https://TestWebApi01.azurewebsites.net" | |
$authority = "https://login.windows.net/MyAadDirectory.onmicrosoft.com" | |
# Create Authentication Context tied to Azure AD Tenant | |
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority |
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 sample CSV file | |
@' | |
ColumnA,ColumnB,ColumnC | |
'row1ColA','row1ColB','row1ColC' | |
'row2ColA','row2ColB','row2ColC' | |
'row3ColA','row3ColB','row3ColC' | |
'@ | Out-File -FilePath (Join-Path $env:TEMP testFoo.csv) | |
### Import the sample CSV file | |
Import-Csv -Path (Join-Path $env:TEMP testFoo.csv) |
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
<# | |
[Video] A Practical Overview of Desired State Configuration | |
http://channel9.msdn.com/events/TechEd/NorthAmerica/2014/DCIM-B417 | |
[eBook] PowerShell.org DSC Hub | |
http://powershell.org/wp/dsc-hub/ | |
[TechNet] Windows PowerShell Desired State Configuration Overview | |
http://technet.microsoft.com/en-us/library/dn249912.aspx |
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
### | |
### Without splatting | |
### | |
Get-Process -Name dns -ComputerName localhost | |
### | |
### With splatting | |
### | |
$myparamas = @{ |
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
<# | |
Script showing how to create a KeyVault vault and enable logging | |
(GUIDs redacted) | |
#> | |
New-AzureRmResourceGroup -Name cmartRG0614 -Location westus | |
<# | |
ResourceGroupName : cmartRG0614 | |
Location : westus | |
ProvisioningState : Succeeded |
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
#region Pester Training | |
start https://app.pluralsight.com/library/courses/powershell-testing-pester/table-of-contents | |
start https://github.com/pester/Pester/wiki | |
#endregion | |
#region Getting PowerShell (comes with Windows 10) | |
### Find the module in the PowerShell Gallery | |
Find-Module -Name Pester -Repository PSGallery |
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
### Server management tools preview (next month): https://blogs.technet.microsoft.com/servermanagement/2016/02/09/introducing-server-management-tools/ | |
### View the online docs | |
start https://docs.microsoft.com/en-us/powershell/azuread/v2/azureactivedirectory | |
### Find the module | |
Find-Module AzureAD | Select-Object * | |
<# | |
Version Name Repository Description |
OlderNewer