Skip to content

devwithkrishna/azure-runcommands-on-vm-vmss-with-python-sdk

Repository files navigation

azure-runcommands-on-vm-vmss-with-python-sdk

Code to execute run commands on Azure VMs and VMSS using python sdks

Why?

  • In Enterprises / Companies There will be multiple VMs or VMSS or both running
  • These might be maintained and updated regularly or not
  • Sometimes there will be a requirement to stop some services or so
  • This can be used for the purpose

Inputs

Inputs Description Required
subscription_name Azure subscription name ✔️
resource_group Azure resource group name ✔️
vm_name or vmss_name Azure Vm or VMSS name ✔️

How

  • This program uses Azure Python SDKs to execute run commands

How to run locally

  • Clone this repo and change directory to azure-runcommands-on-vm-vmss-with-python-sdk

  • Get the required parameters and run the code using below commands

  • python az_vm_runcommands.py --subscription_name <Subscription Name> --resource_group <resource group name> --vm_name <VM name>

  • python az_vmss_runcommands.py --subscription_name <Subscription Name> --resource_group <resource group name> --vmss_name <VMSS name>

References