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
[FunctionName("Function1")] | |
public static async Task<IActionResult> Run( | |
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, | |
ILogger log) | |
{ | |
log.LogInformation("C# HTTP trigger function processed a request."); | |
const string secretName = "Test"; | |
var keyVaultName = "test-blog-kv"; | |
var kvUri = $"https://{keyVaultName}.vault.azure.net"; |
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
static async Task Main(string[] args) | |
{ | |
const string secretName = "Test"; | |
var keyVaultName = "test-blog-kv"; | |
var kvUri = $"https://{keyVaultName}.vault.azure.net"; | |
DefaultAzureCredentialOptions options = new DefaultAzureCredentialOptions(); | |
options.ExcludeEnvironmentCredential = true; | |
options.ExcludeInteractiveBrowserCredential = true; | |
options.ExcludeManagedIdentityCredential = true; |
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
const string secretName = "Test"; | |
var keyVaultName = "test-blog-kv"; | |
var kvUri = $"https://{keyVaultName}.vault.azure.net"; | |
// Creating an object and excluding methods which I do not want to be executed. Although these are executed in series, i.e. in my code, due to Enviornment Variables or Visual Studio exception was thrown. | |
// Ideally I would expect, if one method does not work, without breaking code it should move to another one. | |
DefaultAzureCredentialOptions options = new DefaultAzureCredentialOptions(); | |
options.ExcludeEnvironmentCredential = true; | |
options.ExcludeInteractiveBrowserCredential = true; | |
options.ExcludeManagedIdentityCredential = true; |
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
const string secretName = "TestName"; | |
var keyVaultName = "test-blog-kv"; | |
var kvUri = $"https://{keyVaultName}.vault.azure.net"; | |
var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential()); | |
var secret = await client.GetSecretAsync(secretName); |
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 -RunAsAdministrator | |
<# | |
.SYNOPSIS | |
Creates a Self Signed Certificate for use in server to server authentication | |
.DESCRIPTION | |
.EXAMPLE | |
.\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 | |
This will create a new self signed certificate with the common name "CN=MyCert". During creation you will be asked to provide a password to protect the private key. | |
.EXAMPLE | |
.\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 -Password (ConvertTo-SecureString -String "MyPassword" -AsPlainText -Force) |
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
Try{ | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll' | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll' | |
} | |
catch { | |
Throw "Unable to load SharePoint Client runtime" | |
} |
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
/// <summary> | |
/// Function to display password string as *, return appropriate one to the code. | |
/// </summary> | |
public static string ReadLineMasked(char mask = '*') | |
{ | |
var sb = new StringBuilder(); | |
ConsoleKeyInfo keyInfo; | |
while ((keyInfo = Console.ReadKey(true)).Key != ConsoleKey.Enter) | |
{ | |
if (!char.IsControl(keyInfo.KeyChar)) |
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
#Note that you should be running PowerShell as an Administrator | |
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") | |
$publish = New-Object System.EnterpriseServices.Internal.Publish | |
$publish.GacInstall("C:\Path\To\DLL.dll") |
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
Try{ | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll' | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll' | |
} | |
catch { | |
Write-Host $_.Exception.Message | |
Write-Host "No further parts of the migration will be completed" | |
} | |
Function UploadFileInSlice ($ctx, $libraryName, $fileName, $fileChunkSizeInMB) { |
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
function ChangePageLayout() | |
{ | |
param( | |
[Parameter(Mandatory=$true)][string]$siteurl, | |
[Parameter(Mandatory=$false)][System.Net.NetworkCredential]$credentials, | |
[Parameter(Mandatory=$false)][string]$PageName, | |
[Parameter(Mandatory=$false)][string]$PageLayoutName, | |
[Parameter(Mandatory=$false)][string]$PageLayoutDisplayName, | |
[Parameter(Mandatory=$false)][string]$Title, | |
[Parameter(Mandatory=$false)][bool]$isCustomPageLayout |
NewerOlder