This file contains hidden or 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
| # on WSL, run the following sh. | |
| # https://github.com/k3s-io/k3s?tab=readme-ov-file#quick-start---install-script | |
| curl -sfL https://get.k3s.io | sh - | |
| # https://devops.stackexchange.com/questions/16043/error-error-loading-config-file-etc-rancher-k3s-k3s-yaml-open-etc-rancher | |
| mkdir ~/.kube 2> /dev/null | |
| sudo k3s kubectl config view --raw > "$KUBECONFIG" | |
| chmod 600 "$KUBECONFIG" |
This file contains hidden or 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
| $thumbprintList = @( | |
| 'CERTIFICATETHUMBPRINT', | |
| 'CERTIFICATETHUMBPRINT2' | |
| ) | |
| $report = foreach ($thumbprint in $thumbprintList) { | |
| $cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Thumbprint -eq $thumbprint } | |
| if ($cert) { | |
| $key = [Security.Cryptography.X509Certificates.RSACertificateExtensions]::GetRSAPrivateKey($cert) | |
| $file = Get-ChildItem -Path 'C:\ProgramData\Application Data\Microsoft\Crypto' -Recurse -Filter $key.key.UniqueName | |
| [pscustomobject]@{ |
This file contains hidden or 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
| # Get all .crt certificates, excluding those with 'bundle' in the name | |
| $crtCerts = Get-ChildItem -Path . -Recurse -Filter *.crt | Where-Object { $_.Name -notmatch 'bundle' } | ForEach-Object { | |
| $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($_.FullName) | |
| [PSCustomObject]@{ | |
| FileName = $_.Name | |
| Subject = $cert.Subject | |
| SerialNumber = $cert.SerialNumber | |
| Thumbprint = $cert.Thumbprint | |
| PublicKey = $cert.GetPublicKeyString() | |
| } |
This file contains hidden or 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
| $token = "" # DT Token | |
| $hostname = hostname | |
| $processName = "process-name" #replace process name #by default is an IIS app pool | |
| $headers = @{ | |
| "Authorization" = "Api-Token $token" | |
| } | |
| # Proprerties you want to log | |
| $customObject = @{ |
This file contains hidden or 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
| # Quick Working POC using for loops in bicep to create an App Service Plan and AppServices from an array. | |
| # https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/loops | |
| @description('The Azure region into which the resources should be deployed.') | |
| param location string = 'southcentralus' | |
| @description('app services to provision') | |
| param appServiceAppNames array = [ | |
| 'App1' |
This file contains hidden or 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
| # Get team id: | |
| # https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name | |
| # Create new deployment environment and protect it | |
| gh api \ | |
| --method PUT \ | |
| repos/ORG/REPO/environments/NEW_ENV \ | |
| -f "reviewers[][type]=Team" -F "reviewers[][id]=TEAMID" | |
| # Remove team from deployment environment |
This file contains hidden or 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
| # Test-SQLConnection "Data Source=localhost,1433;database=myDB;User ID=myUser;Password=myPassword;" | |
| function Test-SQLConnection { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
| [string] $ConnectionString | |
| ) | |
| process { |
This file contains hidden or 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
| $Url = "https://google.com" | |
| try { | |
| $response = Invoke-WebRequest $Url -UseBasicParsing -UseDefaultCredentials | |
| $statusCode = $response.StatusCode | |
| $responseContent = $response.Content | |
| $responseHeaders = $response.Headers | |
| $responseRawContent = $response.RawContent | |
| $responseAllProperties = $response | Select-Object * | |
| } catch { |
This file contains hidden or 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
| # get Service CIDR | |
| az account set --subscription $subscriptionId | |
| $aksInfo = az aks show -g $aksResourceGroup -n $aksInstanceName | ConvertFrom-Json | |
| $aksInfo.networkProfile.serviceCidrs |
This file contains hidden or 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
| # get Cipher Suites and min protocol version | |
| az account set --subscription $subscriptionId | |
| $sslPolicy = az network application-gateway show -n $applicationGateway --resource-group $agResourceGroup | convertFrom-Json | |
| az network application-gateway ssl-policy predefined show -n $sslPolicy.defaultPredefinedSslPolicy |
NewerOlder