This script demonstrates how to provision a virtual machine (VM) in Azure using Python and the Azure SDK. The script performs the following tasks:
- Sets up credential management.
- Provisions a resource group.
- Creates a network security group.
- Provisions a virtual network (VNet).
- Provisions a subnet.
- Provisions a public IP address.
- Provisions a network interface.
- Provisions the VM.
- Python 3.x
- Azure SDK for Python
- Visual Studio Code or any Python IDE
-
Prerequisites: Ensure you have Azure subscription with admin priviliges
-
Install Azure SDK for Python
pip install azure-identity azure-mgmt-resource azure-mgmt-compute azure-mgmt-network
-
Set Up Environment Variables
- Make sure to replace the placeholder values with your actual Azure AD tenant ID, client ID, secret key, and subscription ID
tenantid = '<your-tenant-id>' subscription_id = '<your-subscription-id>' clientid = '<your-client-id>' secretkey = '<your-secret-key>'
-
Run the Script
python vm-provision.py
- Maybe work on a project to provide parameterized fullstack provisioning in azure