Skip to content

PowerShell script that deletes Azure virtual machines and associated resources

License

Notifications You must be signed in to change notification settings

mattdavis5/decommission-azure-vm-resources

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

decommission-azure-vm-resources

PowerShell script that deletes Azure virtual machines and associated resources, including network interfaces, public IP addresses, network security groups, and disks.

Users will be prompted for which resources to be deleted along with their associated virtual machine, therefore any combination of these resources may be deleted.

If a resource has a -DeleteOption property value of 'Delete', the resource will be automatically deleted when the virtual machine is deleted, and this script will skip its delete operation. Those with a -DeleteOption property of 'Detach' will re-prompt the user if they should be deleted prior to performing the delete operation.

Get Started

Install Modules

To install the required modules to run this script, follow the instructions below.

  1. Open PowerShell as Administrator
  2. Run the command to install the Azure PowerShell module -
    Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

Azure Requirements

This script requires an Azure account to connect to, with privileges that allow administration of virtual machines.

About

PowerShell script that deletes Azure virtual machines and associated resources

Topics

Resources

License

Stars

Watchers

Forks