Skip to content

Instantly share code, notes, and snippets.

View UstDoesTech's full-sized avatar
🏠
Working from home

Ust Oldfield UstDoesTech

🏠
Working from home
View GitHub Profile
# Login to Azure
Connect-AzAccount
$keyvaultName = "name of your Key Vault"
$region = "europewest"
$path = "C:\LocalFolder\PublicIPs_20190107.xml"
# Do not change me
$xPath = "/AzurePublicIpAddresses/Region"
$regionIP = Select-Xml -Path $Path -XPath $Xpath | Select-Object -ExpandProperty Node | Where-Object Name -eq $region
# Login to Azure
Connect-AzAccount
Set-Location $PSScriptRoot;
$resourceGroupName = "ResourceGroup"
$serverName = "sqlserverinstance01"
$path = "C:\LocalFolder\PublicIPs_20190107.xml"
$xPath = "/AzurePublicIpAddresses/Region"
$environmentCode = "TST"
$testCategoryCode = "INT"
$testTypeCode = "COMPEXIST"
$connString = "Server connection details"
# Setup Environment (metadata database)
$obtainTests = "EXEC Test.ObtainTests '$environmentCode', '$testCategoryCode', '$testTypeCode'"
$tests = Invoke-Sqlcmd -ConnectionString ($connString) -Query $obtainTests
# Validate Deployment of components using Pester
$environmentCode = "TST"
$testCategoryCode = "INT"
$testTypeCode = "INTR2C"
$connString = "Server connection details"
$dwConnString = "Server connection details"
Set-Location $PSScriptRoot
$obtainTests = "EXEC Test.ObtainTests '$environmentCode', '$testCategoryCode', '$testTypeCode'"
$tests = Invoke-Sqlcmd -ConnectionString $connString -Query $obtainTests
Set-Location $PSScriptRoot;
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
Install-Module -Name Pester -Force -Scope CurrentUser -SkipPublisherCheck -AllowClobber
Install-Module -Name SqlServer -Force -Scope CurrentUser -AllowClobber
Import-Module -Name Pester -Force
Invoke-Pester -OutputFile "integrationTestResults1.xml" -OutputFormat NUnitXml -Script @{Path = './ComponentExists.Integration.tests.ps1'}
# Stop all other tests if and ComponentExists test fail
$connString = "Server connection details"
$environmentCode = "TST"
$testCategoryCode = "REG"
if($null -eq (Get-AzureRmContext).Account){
Connect-AzureRmAccount
}
Set-Location $PSScriptRoot
USE AdventureWorks2012;
WITH
LocalExchange AS (
SELECT
ToCurrencyCode AS CurrencyCode,
CASE WHEN ToCurrencyCode <> 'EUR' THEN (1 / AverageRate) END AS LocalCurrencyConversion,
CurrencyRateDate
FROM [Sales].[CurrencyRate] ),
EuroExchange AS (
@UstDoesTech
UstDoesTech / s3-autoloader-azure-databricks.py
Created October 21, 2021 10:22
Using Autoloader with S3 on Azure Databricks. Temporary Credential Authentication Method
# COMMAND ----------
import boto3
from botocore.config import Config
# COMMAND ----------
awsAccessKeyId = dbutils.secrets.get("scopeName", key = "AWSAccessKeyID")
awsSecretAccessKey = dbutils.secrets.get("scopeName", key = "AWSSecretAccessKey")
def checkTheList(list):
checklist = [{"name": "Lovehaze", "isNice": False}, {"name": "Cloudtrip", "isNice": True}, {"name": "Moonsounds", "isNice": False}, {"name": "Startrance", "isNice": True}, {"name": "Freedream", "isNice": False}]
if list == checklist:
return True
else:
return False
def cryingChild(list):
for child in children:
parameters:
group: variable-group
azureResourceManagerConnection: 'Service_Connection_Name'
deploymentName: stage_deployment
displayName: SynapseDeployment
environment: Development
jobs:
- deployment: ${{ parameters.deploymentName }}