View Invoke-RestMethod.ps1
This file contains 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
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[String] $appID, | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[string] $appSecret, | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[string] $subID |
View Azure-KeyVault-SP-GetList-Access.ps1
This file contains 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
<# | |
.DESCRIPTION | |
This script will create or use an Existing Key Vault, followed by adding 3 secrets for a service principal | |
- ClientID | |
- ClientSecret | |
- TenantID | |
Once the key vault is created, the service principal is provided Get and List permissions to fetch the keys. | |
.PARAMETER -keyVaultName | |
The name of the existing or new Key Vault | |
.PARAMETER -Location |
View install-Az-Graph-Module.ps1
This file contains 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
# Install the PowerShell Module | |
Install-Module -Name Az.ResourceGraph | |
# Get Commands | |
Get-Command -Module ‘Az.ResourceGraph' | |
# Get Help with Examples | |
Get-Help Search-AzGraph -Examples |
View Azure-ResourceGraph-Storage.ps1
This file contains 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
# Global Variables | |
$resourceType = 'microsoft.storage/storageAccounts' | |
## EXAMPLE 1 - Find tags for Storage Accounts | |
$query = "where type =~ '$resourceType' | project name, resourceGroup, type, location, tags" | |
Search-AzGraph -Query $query | |
## EXAMPLE 2 - Display Count for the Service Tag | |
$query = "where type =~ '$resourceType' | project tag = tostring(tags.Service) | summarize count() by tag" | |
Search-AzGraph -Query $query |
View Install-Pulumi.cmd
This file contains 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
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://get.pulumi.com/install.ps1'))" && SET "PATH=%PATH%;%USERPROFILE%\.pulumi\bin" |
View Server_Shutdown_Startup.ps1
This file contains 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
<# | |
.SYNOPSIS | |
Connects to Azure and stops of all VMs in parallel for the scheduled resource group | |
.DESCRIPTION | |
This runbook connects to Azure and stops all ARM Azure VMs within a resource group | |
You should attach a schedule to this runbook to run it at a specific time. | |
REQUIRED AUTOMATION ASSETS | |
1. An Automation variable asset called "SubscriptionId" that contains the GUID for this Azure subscription. | |
To use an asset with a different name you can pass the asset name as a runbook input parameter or change the default value for the input parameter. | |
2. An Automation credential asset called "AzureCred" that contains the Azure AD user credential with authorization for this subscription. |
View GitInit.ps1
This file contains 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
# Initialise the local GIT repository (Needs to be run from the repository directory | |
git init | |
# You should see the following output "Initialized empty Git repository in C:/users/user/source/repos/.git/" | |
# Run the follow command to show the hidden Git file. This tracks any changes made to the repository | |
dir -ah | |
# To sync to the Azure DevOps Project, use the HTTPs push command found in your Azure DevOps Project under "Repos" | |
git remote add origin https://xxxxxx@dev.azure.com/xxxxxx/IaaSv1/_git/Blog | |
git push -u origin --all |