Skip to content

Instantly share code, notes, and snippets.

View jtourlamain's full-sized avatar

Jan Tourlamain jtourlamain

View GitHub Profile
@jtourlamain
jtourlamain / UpdateIISExpressCertificate.ps1
Last active May 3, 2018 08:04 — forked from camieleggermont/UpdateIISExpressCertificate.ps1
This powershell script generates a new certificate, removes the old certificate assignments from the IISExpress ssl ports and adds the newly generated one. The certificate is also copied over to the Trusted Root Certificate Authorities.
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
$thumb = $cert.GetCertHashString()
For ($i=44300; $i -le 44399; $i++) {
netsh http delete sslcert ipport=0.0.0.0:$i
}
For ($i=44300; $i -le 44399; $i++) {
netsh http add sslcert ipport=0.0.0.0:$i certhash=$thumb appid=`{214124cd-d05b-4309-9af9-9caa44b2b74a`}
}
@jtourlamain
jtourlamain / GetTokenFromO365.ps1
Last active February 21, 2018 21:20
GetTokenFromO365
# Load ADAL Assemblies
$adal = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
$adalforms = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
[System.Reflection.Assembly]::LoadFrom($adal)
[System.Reflection.Assembly]::LoadFrom($adalforms)
# Set Azure AD Tenant name
$adTenant = "devprotocol.onmicrosoft.com"
# Set well-known client ID for AzurePowerShell
$clientId = "45c1b239-339f-4b9a-b9fe-6e087e37f549"