Skip to content

Instantly share code, notes, and snippets.

View jasonhorner's full-sized avatar
🌴
On vacation

Jason Horner jasonhorner

🌴
On vacation
View GitHub Profile
@jasonhorner
jasonhorner / installtools.cmd
Created September 19, 2024 08:15
Winget Install Script
@echo off
echo Installing applications using winget...
set apps=(
"Microsoft.AzureCLI"
"Microsoft.AzureDeveloperCLI"
"Git.Git"
"GitHub.cli"
"Microsoft.Powershell"
"Microsoft.WindowsTerminal"
@jasonhorner
jasonhorner / assign-roles.sh
Last active September 10, 2024 03:23
Assigns Azure Entra Roles
#!/bin/bash
# Input parameters
userPrincipalName=$1
tenantId=$2
# Check if both parameters are provided
if [ -z "$userPrincipalName" ] || [ -z "$tenantId" ]; then
echo "Usage: $0 <userPrincipalName> <tenantId>"
exit 1
@jasonhorner
jasonhorner / database-metadata-metrics
Last active February 15, 2024 17:16
SQL Server metadata query with column info
with schema_info
as (SELECT t.table_catalog
, t.table_schema
, t.table_name
, (
SELECT
c.column_name,
c.ordinal_position,
CASE
WHEN c.DATA_TYPE IN ('varchar', 'char', 'varbinary', 'binary') THEN
@jasonhorner
jasonhorner / AzureSqlMonitoring.md
Last active October 2, 2021 19:28
Resources for my Azure SQL Monitoring Talk

Azure SQL Monitoring Resources

This page has the resources for my Azure SQL Monitoring Talk

Abstract

Migrating you on-premises Database to Azure SQL DB was easy but now comes the hard part how do you setup monitoring and alerts? While there are many 3rd party options, let's have a look at what comes standard with Azure:

  • Using Azure Log Analytics to monitor databases
  • How can you be sure your azure SQL Database isn't under or over allocated, so that your costs are optimized.
  • How can you project what future costs may be.
@jasonhorner
jasonhorner / sql_table_metadata.sql
Created August 16, 2021 17:31 — forked from OsirisDBA/sql_table_metadata.sql
SQL Server Table Metadata
DECLARE @SchemaName sysname = ''
, @TableName sysname = '';
WITH pk /* Primary Keys */
AS ( SELECT t.object_id
, pkc.column_id
, ic.index_column_id pk_index
, pk.name AS pk_name
FROM sys.tables t
JOIN sys.schemas s ON s.schema_id = t.schema_id
@jasonhorner
jasonhorner / sql_table_metadata.sql
Created August 16, 2021 17:31 — forked from OsirisDBA/sql_table_metadata.sql
SQL Server Table Metadata
DECLARE @SchemaName sysname = ''
, @TableName sysname = '';
WITH pk /* Primary Keys */
AS ( SELECT t.object_id
, pkc.column_id
, ic.index_column_id pk_index
, pk.name AS pk_name
FROM sys.tables t
JOIN sys.schemas s ON s.schema_id = t.schema_id
@jasonhorner
jasonhorner / sql_table_metadata.sql
Created August 16, 2021 17:31 — forked from OsirisDBA/sql_table_metadata.sql
SQL Server Table Metadata
DECLARE @SchemaName sysname = ''
, @TableName sysname = '';
WITH pk /* Primary Keys */
AS ( SELECT t.object_id
, pkc.column_id
, ic.index_column_id pk_index
, pk.name AS pk_name
FROM sys.tables t
JOIN sys.schemas s ON s.schema_id = t.schema_id
@jasonhorner
jasonhorner / settings.json
Created February 9, 2021 19:33
Windows Terminal Settings File
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",