Skip to content

placerda/azure-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ azure-utils

A small toolbox of PowerShell scripts to simplify Azure cleanup and maintenance.
Each script comes with a one-liner you can copy, paste, and run instantly.

Prerequisites

  • PowerShell 7+ (pwsh)

  • Azure CLI (az) installed and logged in:

    az login
  • Permissions to manage the target resources

  • Azure CLI extensions configured to allow preview versions and install without prompts:

    az config set extension.dynamic_install_allow_preview=true
    az config set extension.use_dynamic_install=yes_without_prompt

How to Use

Tip

Copy the command below each script and run it in PowerShell 7.

πŸ“‘ Table of Contents

GPT-RAG

🧠 Query Orchestrator (Local/Remote) β€” ps/invoke-orchestrator.ps1

Sends queries to the orchestrator running locally or in Azure Container Apps with conversation tracking and token caching.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/invoke-orchestrator.ps1').Content"

Local usage examples:

# Interactive mode
.\ps\invoke-orchestrator.ps1

# Clear cache and start fresh
Remove-Item "$env:TEMP\invoke-orchestrator-last.ps1" -ErrorAction SilentlyContinue
.\ps\invoke-orchestrator.ps1

Container Apps

πŸ”‘ Fetch a Dapr token for local/dev β€” ps/get-dapr-token.ps1

Retrieves a Container App Dapr API token for connecting local or dev services.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/get-dapr-token.ps1').Content"

AI Search

πŸ” Check Azure AI Search Agentic setup β€” ps/check-agentic-setup.ps1

Verifies Azure AI Search Agentic Retrieval configuration, knowledge sources, vectorizers, and semantic search settings.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/check-agentic-setup.ps1').Content"

πŸ€– Invoke Knowledge Agent Retrieval β€” ps/invoke-agentic-retrieval.ps1

Performs agentic retrieval queries using Azure AI Search Knowledge Agents with formatted results and activity tracking.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/invoke-agentic-retrieval.ps1').Content"

πŸ—‚οΈ Remove docs from an AI Search index β€” ps/rm-index-documents.ps1

Deletes documents from a Search index (by key or filter) to keep it tidy.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/rm-index-documents.ps1').Content"

Resource Group

🧹 Clean up and delete a Resource Group β€” ps/rm-rg.ps1

Removes blockers (NSGs, Private Endpoints, subnet settings, PDNS links, locks, etc.) and forcefully deletes the Resource Group.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/rm-rg.ps1').Content"

🌐 Enable public access in a Resource Group β€” ps/set-public.ps1

Turns on public network access for Storage Accounts, Key Vaults, and Cosmos DB (does not remove private endpoints).

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/set-public.ps1').Content"

Networking

πŸ—οΈ Create an Azure Virtual Network β€” ps/create-vnet.ps1

Creates a new Azure VNet with interactive prompts. Remembers your last settings and creates the resource group if it doesn’t exist.

pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/create-vnet.ps1').Content"

🧩 Create an Azure VNet with Pre-configured Subnets β€” ps/create-vnet-with-subnets.ps1

Creates an Azure VNet with multiple pre-configured subnets for enterprise workloads.

Features:

  • 9 base subnets (agent, ACA, PE, Bastion, Firewall, Gateway, App Gateway, Jumpbox, DevOps)
  • 2 optional subnets for API Management and PostgreSQL (-SkipApim, -SkipPostgres)
  • Address space: 192.168.0.0/21
  • Delegations: Microsoft.App/environments, Microsoft.DBforPostgreSQL/flexibleServers
  • Service endpoints: CognitiveServices, AzureCosmosDB
  • PE subnet /26 to prevent race conditions
  • Remembers previous settings like create-vnet.ps1
pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/create-vnet-with-subnets.ps1').Content"

Local usage examples:

# Interactive mode
.\ps\create-vnet-with-subnets.ps1

# With parameters
.\ps\create-vnet-with-subnets.ps1 -ResourceGroup "my-rg" -VNetName "my-vnet"

# Skip optional subnets
.\ps\create-vnet-with-subnets.ps1 -SkipApim -SkipPostgres

GitHub Projects

πŸ”„ Sync Project Fields β€” ps/gh-projects.ps1

Synchronizes Start Date, End Date, and Status fields from issues in their original GitHub projects to a consolidated project.

Features:

  • Automatic GitHub CLI authentication with project scope
  • Interactive prompts with default values (project 885, org Azure)
  • Syncs date fields from source projects (Start Date, End Date, Target Date)
  • Falls back to Iteration dates when direct dates are unavailable
  • Case-insensitive field name matching
  • Excludes consolidated project from source data search
  • Prioritizes projects with complete date information
  • Syncs status field with emoji cleanup
  • Shows all available fields and their types
  • Detailed progress reporting with debug information

Prerequisites:

  • GitHub CLI (gh) installed
  • Authenticated with GitHub (gh auth login)
  • Project scope enabled (script handles this automatically)
pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/gh-projects.ps1').Content"

Local usage:

# Interactive mode (with defaults)
.\ps\gh-projects.ps1

Example:

Project number [default: 885]: <Enter>
Organization/owner [default: Azure]: <Enter>

βœ… Found project: Prometheus Program
βœ… Found 25 items to process

Processing: Azure/doc-proc-solution-accelerator#39
  πŸ“ Found in 2 project(s):
     - Prometheus Program
     - Doc-Proc-Solution-Accelerator
  πŸ” Checking project: Doc-Proc-Solution-Accelerator
     βœ“ Found Iteration: Iteration 3
       - Start: 2025-11-29, Duration: 14 days
     βœ“ Using Iteration Start Date: 2025-11-29
     βœ“ Using Iteration End Date: 2025-12-12
  βœ“ Start:  2025-11-29 (from Iteration (Iteration 3))
  βœ“ End:    2025-12-12 (from Iteration (Iteration 3))
  βœ“ Status: Backlog
  βœ… Updated Start Date to 2025-11-29
  βœ… Updated End Date to 2025-12-12
  βœ… Updated Status to Backlog

πŸ“¦ Migrate Issues Between Repositories β€” ps/gh-migrate-items.ps1

Migrates all issues from one GitHub repository to another, preserving titles, descriptions, labels, and state.

Features:

  • Automatic GitHub CLI authentication
  • Interactive prompts for source and destination repository URLs
  • Migrates all issue data (title, body, labels, state)
  • Creates labels in destination if they don't exist
  • Adds reference to original issue in migrated body
  • Preserves issue state (open/closed)
  • Confirmation prompt before migration
  • Progress reporting with success/failure counts
  • Rate limiting protection

Prerequisites:

  • GitHub CLI (gh) installed
  • Authenticated with GitHub (gh auth login)
  • Write access to destination repository
pwsh -NoProfile -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/placerda/azure-utils/main/ps/gh-migrate-items.ps1').Content"

Local usage:

# Interactive mode
.\ps\gh-migrate-items.ps1

Example:

Source repository URL: https://github.com/Azure/source-repo
Destination repository URL: https://github.com/Azure/dest-repo

βœ… Found 15 issue(s) to migrate

⚠️  WARNING: This will create 15 new issue(s) in Azure/dest-repo
Do you want to continue? (yes/no): yes

Migrating issue #1: First issue title
  βœ… Created: https://github.com/Azure/dest-repo/issues/1

Migrating issue #2: Second issue title
  βœ… Created: https://github.com/Azure/dest-repo/issues/2
  βœ… Closed issue (matching source state)

βœ… Migration completed!
   Success: 15
   Failed:  0

License

MIT β€” see LICENSING.md

About

Handy Azure admin scripts (PowerShell and Bash) for resource groups, VNets, and Azure AI Search indexes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors