Skip to content

Instantly share code, notes, and snippets.

View RichieBzzzt's full-sized avatar
🦆
Sirfetch'd

Richie Lee RichieBzzzt

🦆
Sirfetch'd
View GitHub Profile
trigger:
none
pr:
autoCancel: true
branches:
include:
- none
pool:
cls
$sql_connection_string = "SERVER=.;Integrated Security=True;Database=master"
$sql_connection = new-object System.Data.SqlClient.SqlConnection ($sql_connection_string)
try {
$sql_connection.Open()
return $sql_connection.Database
}
catch {
Write-Error $_.Exception
param(
[string]
$numberOfConcurrentActivities
)
$registryPath = "HKLM:\SOFTWARE\Microsoft\DataTransfer\DataManagementGateway\Gateway"
$Name = "WorkerProcessCount"
if (($numberOfConcurrentActivities -match "^[\d\.]+$") -eq $false)
{
Write-Error "Number of concurrent activites needss to be a number."
Throw
if ($null -eq (Get-AzContext)) {
Write-Host "No Azure Context... logging in."
Login-AzAccount -UseDeviceAuthentication
}
$groups = @("bob","tim"
)
$outputPath = ""
[CmdletBinding()]
param (
[string]$packageSourceUrl = 'https://pkgs.dev.azure.com/[orgname]/[randomguid]/_packaging/[feedname]/nuget/v3/index.json',
[string]$AzDOArtifactFeedName = '[feedname]',
[string]$AzDOPat,
[string]$ModuleFolderPath = (Join-Path -Path $env:SYSTEM_ARTIFACTSDIRECTORY -ChildPath "[.artifact.alias]\[folder.what.contains.module]")
)
# Variables
$feedUsername = 'NotChecked'
Function Publish-DatabaseDeployment {
param(
$dacfxPath
, $dacpac
, $publishXml
, $targetConnectionString
, $targetDatabaseName
)
Write-Verbose 'Testing if DACfx was installed...' -Verbose
#Requires -Version 3.0
#Requires -Module AzureRM.Resources
#Requires -Module Azure.Storage
#Requires -Module @{ModuleName="AzureRm.Profile";ModuleVersion="3.0"}
Param(
[string] [Parameter(Mandatory = $true)] $ArtifactStagingDirectory,
[string] [Parameter(Mandatory = $true)][alias("ResourceGroupLocation")] $Location,
[string] $ResourceGroupName = (Split-Path $ArtifactStagingDirectory -Leaf),
[switch] $UploadArtifacts,
function Set-LocalNotebook ($DatabricksFile, $Language, $LocalOutputPath, $Format = "SOURCE") {
$DatabricksFileForUrl = Format-DataBricksFileName -DataBricksFile $DatabricksFile
$uri = "$global:DatabricksURI/api/2.0/workspace/export?path=" + $DatabricksFileForUrl + "&format=$Format&direct_download=false"
switch ($Format) {
"SOURCE" {
$FileExtentions = @{"PYTHON" = ".py"; "SCALA" = ".scala"; "SQL" = ".sql"; "R" = ".r" }
$FileExt = $FileExtentions[$Language]
}
"HTML" {
$aadConnectionString = "Server=tcp:$($AzureSqlFQDN),1433;Initial Catalog=myLittleDatabbase;Persist Security Info=False;User ID=$($aadAdminUser);Password=$($aadAdminPassword);MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication=""Active Directory Password"";"
@RichieBzzzt
RichieBzzzt / keyvault_arm_with_access_policy.json
Created July 24, 2019 08:17
part of arm template for deploying keyvault
{
"type": "Microsoft.KeyVault/vaults",
"name": "[parameters('keyVaultName')]",
"apiVersion": "2018-02-14",
"location": "[resourceGroup().location]",
"tags": {},
"scale": null,
"properties": {
"sku": {
"family": "A",