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 | |
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 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 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 (blakedrumm@microsoft.com) | |
# 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 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 (blakedrumm@microsoft.com) | |
# 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 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 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 (blakedrumm@microsoft.com) | |
# Website: https://blakedrumm.com/ | |
# Date created: April 4th, 2024 | |
# ============================================================================ | |
$AzureRmContext = Connect-AzAccount |
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
# Author: Blake Drumm (blakedrumm@microsoft.com) | |
# 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 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 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 (blakedrumm@microsoft.com) | |
# Created: March 26th, 2024 | |
# Retrieve PSModulePath | |
$modulePaths = $env:PSModulePath -split ';' | |
# Retrieve all installed modules | |
$installedModules = Get-Module -ListAvailable | |
if ($installedModules) { |
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
/* | |
Author: Blake Drumm (blakedrumm@microsoft.com) | |
Date Created: February 27th, 2024 | |
Description: | |
Azure Resource Graph query for enhanced inventory management of microsoft.hybridcompute/machines, | |
detailing essential attributes such as display names, operating system versions with friendly names for Windows 11, | |
Windows 10, and various Windows Server releases, agent version, automatic upgrade capability, provisioning state, | |
and ESU license status. By using regular expressions for accurate OS version categorization, it offers administrators | |
and support teams a powerful tool for comprehensive oversight and management of hybrid computing environments, | |
facilitating effective upgrade planning, compliance monitoring, and support tasks. |
NewerOlder