Skip to content

nicolasnkGH/powershell-Scripting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Simple Azure VM Provisioning with GitHub Actions

πŸš€ Project Overview

This project demonstrates Infrastructure as Code (IaC) by provisioning Azure virtual machines using:

  • PowerShell scripts (Invoke-AzureProvisioning.ps1) to run Azure CLI commands
  • YAML workflow (.github/workflows/main.yaml) to automate everything via GitHub Actions

The result is a repeatable, automated process for creating and managing Azure infrastructure.


πŸ“‚ Key Files

  • .github/workflows/main.yaml
    Defines the GitHub Actions workflow. Handles logging into Azure and running the provisioning script.

    You can customize VM names, resource group, and other settings directly in this file.

  • Invoke-AzureProvisioning.ps1
    PowerShell script containing all the Azure CLI commands for creating resources:

    • Resource group
    • Virtual network
    • Network security groups
    • Two virtual machines

βš™οΈ How to Use

1. Configure GitHub Secrets

This workflow requires your Azure credentials and SSH public key.
Create the following repository secrets in Settings β†’ Secrets β†’ Actions:

  • AZURE_CREDENTIALS β†’ Your Azure Service Principal credentials
  • SSH_PUBLIC_KEY β†’ The content of your SSH public key

2. Trigger the Workflow

  1. Navigate to the Actions tab in your GitHub repo
  2. Select Provision Azure Infrastructure workflow
  3. Click Run workflow

The provisioning process will begin automatically. βœ…


πŸŽ›οΈ Customization

To customize resource names or settings, edit the environment variables in .github/workflows/main.yaml:

name: Provision Azure Infrastructure

jobs:
  provision-vms:
    runs-on: ubuntu-latest
    env:
      AZURE_RESOURCE_GROUP: 'your-resource-group'
      AZURE_LOCATION: 'your-azure-region'
      PIHOLE_VM_NAME: 'your-pihole-vm'
      DYNATRACE_VM_NAME: 'your-dynatrace-vm'
      VM_USERNAME: 'your-username'

βœ… Provisioning Success!

The result is a repeatable, automated process for creating and managing Azure infrastructure.

Azure resources created by the workflow GitHub Actions workflow status GitHub Actions workflow run event


Notes

  • This project demonstrates Infrastructure as Code (IaC) using GitHub Actions + PowerShell.
  • Future enhancements will allow the workflow to prompt for inputs so you can choose whether to provision or destroy resources dynamically.
  • Ideal for learning CI/CD + Azure automation in a real-world DevOps scenario.

πŸ› οΈ Roadmap / To-Do

  • Provision Azure VMs using GitHub Actions + PowerShell
  • Add screenshots to validate provisioning
  • Create Destroy-AzureResources.ps1 to tear down infrastructure
  • Add script to deploy Pi-hole on VM1
  • Add script to deploy Dynatrace on VM2
  • Update workflows to accept user inputs (resource group, VM names, action: provision/destroy)
  • Make scripts fully reusable without manual edits

About

powershell scripting POC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •