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
param ( | |
[Parameter(Mandatory=$false)] | |
[String]$AzureCredentialAssetName = "VMPowerServicePrincipal", | |
[Parameter(Mandatory=$false)] | |
[String]$AzureSubscriptionIDAssetName = "VMShutdownTargetSubscription", | |
[Parameter(Mandatory=$false)] | |
[String]$AzureTenantIDAssetName = "VMShutdownTargetTenant" | |
) |
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
$myEmailOrUpn = 'some.user@some.doman' | |
# can use your mailbox login | |
$cred = Get-Credential | |
$exoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $cred -Authentication "Basic" -AllowRedirection | |
# Loads session and EXO Cmdlets | |
Import-PSSession $exoSession |
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
Configuration Main | |
{ | |
Import-DscResource –ModuleName 'PSDesiredStateConfiguration' | |
Node ('localhost') | |
{ | |
Script DeployWindowsService | |
{ | |
GetScript = { | |
@{ |
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
# Requires PowerShell to be run as Admin-level user. | |
New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" ` | |
-Subject "cn=mydemokvcert" -KeyDescription "Used to access Key Vault" ` | |
-NotBefore (Get-Date).AddDays(-1) -NotAfter (Get-Date).AddYears(2) | |
# PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\my | |
# | |
#Thumbprint Subject | |
#---------- ------- |
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 new Service Principal with Cert configured | |
## | |
Login-AzureRmAccount -SubscriptionId XXXXXXXX-XXXX-XXXX-XXXX-86b9ebca2d13 | |
# $credValue comes from the previous script and contains the X509 cert we wish to use. | |
# $validFrom comes from the previous script and is the validity start date for the cert. | |
# $validTo comes from the previous script and is the validity end data for the cert. |
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
{ | |
"frameworks": { | |
"net46": { | |
"dependencies": { | |
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.1", | |
"Microsoft.IdentityModel.Logging": "1.0.0", | |
"Microsoft.Azure.Common": "2.1.0", | |
"Microsoft.Azure.KeyVault": "1.0.0", | |
} | |
} |
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
#r "System.Runtime" | |
#r "System.Threading.Tasks" | |
using System; | |
using System.Threading.Tasks; | |
using System.Web.Configuration; | |
using Microsoft.IdentityModel.Clients.ActiveDirectory; | |
using Microsoft.Azure.KeyVault; | |
using System.Security.Cryptography.X509Certificates; |
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 "keyvaultclient.csx" | |
public static void Run(TraceWriter log) | |
{ | |
var secretStringClearText = GetKeyVaultSecret("remotepassword"); | |
log.Info(secretStringClearText); | |
} |
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
{ | |
"frameworks": { | |
"net46": { | |
"dependencies": { | |
"Sendgrid": "8.0.5" | |
} | |
} | |
} | |
} |
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
{ | |
"bindings": [ | |
{ | |
"type": "sendGrid", | |
"name": "message", | |
"direction": "out", | |
"from": "your.sender@your.domain", | |
"subject": "Functions r0ck5!" | |
} | |
], |