Skip to content

Instantly share code, notes, and snippets.

@bjh1977
bjh1977 / CreateAADApplication.ps1
Last active October 25, 2020 05:33
Create AAD Application, Azure Key Vault, Azure Key Vault Key, Rights to Vault from Application (created for use with Extensible Key Management Using Azure Key Vault (SQL Server))
param (
[string]$Version = $( Read-Host "Input version" ),
[string]$DomainName = $( Read-Host "Input domain name" ),
[string]$ApplicationName = $( Read-Host "Input application name" )
)
$ApplicationURI = $("https://$DomainName/$ApplicationName")
@bjh1977
bjh1977 / Install_Nuget_exe_to_temp_folder.ps1
Created March 26, 2018 15:00
Install the latest version of Nuget to current user's temp folder
$InstallDir = join-path $env:temp 'Nuget'
if (Test-Path $InstallDir) {
Remove-Item -Path $InstallDir -Recurse -Force
}
New-Item -Path $InstallDir -ItemType Directory -Force | Out-Null
# grab nuget commandline from internet
@bjh1977
bjh1977 / Install-NugetFromNugetOrg.ps1
Created October 3, 2018 11:27
Gets nuget from nuget.org. Either the latest or a sprecific version
function Install-NugetFromNugetOrg {
<#
.Synopsis
Gets nuget from nuget.org
.Description
Gets nuget from nuget.org. Either the latest or a sprecific version
.Parameter RequiredVersion
The version as seen on www.nuget.org
.Parameter RootFolder
The root folder where nuget will be copied to
This file has been truncated, but you can view the full file.
Function Install-ADAuthenticationLibraryforSQLServer {
$workingFolder = Join-Path $env:temp ([System.IO.Path]::GetRandomFileName())
New-Item -ItemType Directory -Force -Path $workingFolder
$fileName = 'adalsql.msi'
$Installer = Join-Path -Path $WorkingFolder -ChildPath $fileName
$path = "\\path\to\file\msoidcli_64bit.msi"
$comObjWI = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $comObjWI.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
$Query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
$View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
$Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
[uri] $BlobURI = New-AzureStorageBlobSASToken -Context $context -CloudBlob $blob.ICloudBlob -Permission r -ExpiryTime $ExpiryTime -FullUri
New-AzureRmAutomationModule -Name $ModuleName -ResourceGroupName $AutomationResourceGroupName -AutomationAccountName $AutomationAccountName -ContentLink $BlobUri
#
# More info here: https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-powershell
#
Login-AzAccount
$ResourceGroupName = '<RESOURCE GROUP NAME>'
$StorageAccountName = '<STORAGE ACCOUNT NAME>'
$filesystemName = 'cont1'
$dirpath = "folderx/y/z1/"
# Point this at your SSIS project directory:
$SearchFolder = 'C:\Users\Joe.Bloggs\source\repos\SSIS_Test1\SSIS_Test1'
$Results = @()
Get-ChildItem $SearchFolder -Filter '*.dtsx' | ForEach-Object {
$FileContent = Get-Content $_.FullName -raw
$FileName = $_.BaseName
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"emailActionGroupName": {
"type": "string",
"metadata": {
"description": "Unique name (within the Resource Group) for the email Action group."
}
},
variables:
- template: azure-pipelines-vars.yml