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
#!/bin/bash | |
# | |
# Copyright (c) Microsoft Corporation. | |
# | |
# This script will | |
# 1. Configure host machine to download from packages.microsoft.com | |
# 2. Install Azcmagent package | |
# 3. Configure for proxy operation (if specified on the command line) | |
# | |
# Note that this script is for Linux only |
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
<# | |
.SYNOPSIS | |
This script lists all virtual machines in each Azure subscription and displays their public IP addresses. | |
.DESCRIPTION | |
The script authenticates using Managed Identity, sets the context to a specified tenant, retrieves all subscriptions | |
in that tenant, and then lists all virtual machines in each subscription along with their public IP addresses if available. | |
.NOTES | |
Ensure that the Managed Identity has sufficient permissions to access subscriptions and resources. |
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
<# | |
.SYNOPSIS | |
Identifies the required modules for a given PowerShell script by analyzing the cmdlets used within the script. | |
.DESCRIPTION | |
The Get-RequiredModules function takes a script as input, extracts all the cmdlets used in the script, and determines which modules | |
these cmdlets belong to. It then returns a unique list of required modules. | |
.PARAMETER Script | |
The content of the PowerShell script to analyze for required modules. |
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
# This script retrieves maintenance configurations and the count of VMs associated with each configuration | |
# The script uses the Azure Maintenance and Azure Resource Graph modules | |
# Author: Blake Drumm ([email protected]) | |
# Date created: May 20th, 2024 | |
# Original location: https://gist.github.com/blakedrumm/70abcf47d0e788d91a7f277d4590f122 | |
# Import the required module | |
Import-Module Az.Maintenance | |
Import-Module Az.ResourceGraph |
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
# Create-MaintenanceConfigManagerRole.ps1 | |
# Script to create a custom role for managing Azure Maintenance Configurations | |
# Author: Blake Drumm ([email protected]) | |
# Website: https://blakedrumm.com/blog/resolve-azure-maintenance-configuration-error/ | |
# Date created: May 15th, 2024 | |
# Date modified: May 15th, 2024 | |
# Define custom variables | |
$subscriptionId = "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p" | |
$resourceGroupName = "ResourceGroupName" |
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
<# | |
.SYNOPSIS | |
Sends detailed reports on Azure Users, Groups, and Roles via email. | |
.DESCRIPTION | |
This PowerShell script generates a report on Azure subscription user roles, groups, and their memberships, and then emails this report as an attachment. It logs into Azure | |
using a managed identity, fetches role assignments for given subscriptions, compiles them into a report, and mails this report to specified recipients. The script uses | |
the .NET Mail API for secure email transmission. | |
.PARAMETER EmailUsername |
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
# ============================================================================ | |
# Name: Run command on Azure Arc machine | |
# ============================================================================ | |
# Author: Blake Drumm ([email protected]) | |
# Website: https://blakedrumm.com/ | |
# Date created: April 4th, 2024 | |
# ============================================================================ | |
$AzureRmContext = Connect-AzAccount |
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
# Author: Blake Drumm ([email protected]) | |
# Date Created: March 27th, 2024 | |
# Website: https://blakedrumm.com/ | |
# Define the HTML content or URL | |
$url = "https://www.catalog.update.microsoft.com/Search.aspx?q=System+Center+2019+-+Operations+Manager" | |
try { | |
# Get the HTML content of the webpage | |
$htmlContent = Invoke-WebRequest -Uri $url |
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
param | |
( | |
[Parameter(Mandatory = $true)] | |
[String[]]$SubscriptionIds, | |
[Parameter(Mandatory = $true)] | |
[String]$TagName, | |
[Parameter(Mandatory = $true)] | |
[String]$TagValue, | |
[Parameter(Mandatory = $true)] | |
[Boolean]$PowerState, # true for start, false for stop |
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
# Author: Blake Drumm ([email protected]) | |
# Created: March 26th, 2024 | |
# Retrieve PSModulePath | |
$modulePaths = $env:PSModulePath -split ';' | |
# Retrieve all installed modules | |
$installedModules = Get-Module -ListAvailable | |
if ($installedModules) { |