Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VM Deployment Template and Debugging Documentation #14257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions quickstarts/vm-deployment-with-custom-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Azure Bicep Deployment Process Log

## Overview
This document logs the process of deploying a virtual machine using Azure Bicep. It includes challenges encountered while deploying locally and through Azure services.

---

## Process Summary

1. **Initial Attempt: Azure Virtual Machine Deployment**
- **Objective**: Deploy a virtual machine using Azure CLI.
- **Issue Encountered**: Subscription was inactive due to expired Azure Free Trial.
- **Actions Taken**: Switched to local deployment using Azure Bicep.

---

## Local Deployment with Bicep

### Step 1: Setting Up Environment
- Installed necessary Azure CLI components:
```bash
sudo apt-get install azure-cli
az bicep install
```
- Verified installation:
```bash
az version
az bicep version
```

### Step 2: Creating a Resource Group
- Attempted to create a resource group:
```bash
az group create --name mockResourceGroup --location eastus
```
- **Error**: Subscription not found.

### Step 3: Adjusting Deployment Scope
- Modified `main.bicep` to target `subscription` scope.
- Validated deployment configuration:
```bash
az deployment sub validate \
--location eastus \
--template-file main.bicep \
--parameters azuredeploy.parameters.json
```
- **Error**: Authorization issues due to missing role assignments.

### Step 4: Authentication Issues
- Re-authenticated using:
```bash
az login --allow-no-subscriptions
```
- Checked account details:
```bash
az account list --output table
```
- Verified permissions:
```bash
az ad signed-in-user show
az role assignment list --assignee "live.com#[email protected]" --all --output table
```

---

## Major Issues Encountered

1. **SubscriptionNotFound Errors**: Due to inactive Azure Free Trial.
2. **AuthorizationFailed Errors**: Missing permissions in Azure AD.
3. **Local Deployment Errors**: Invalid role assignments, incorrect scopes.

---

## Conclusion
Despite multiple debugging attempts, deployment failed due to inactive Azure subscriptions and insufficient permissions. Future steps could involve obtaining a new Azure subscription or using alternative cloud service providers.

---

*End of Log*
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"value": "myVM"
},
"adminUsername": {
"value": "azureUser"
},
"adminPassword": {
"value": "SecureP@ssw0rd!"
}
}
}

24 changes: 24 additions & 0 deletions quickstarts/vm-deployment-with-custom-config/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@description('The name of the virtual machine.')
param vmName string = 'myVM'

@description('The admin username for the VM.')
param adminUsername string = 'azureUser'

@secure()
@description('The admin password for the VM.')
param adminPassword string

resource vm 'Microsoft.Compute/virtualMachines@2021-07-01' = {
name: vmName
location: resourceGroup().location
properties: {
hardwareProfile: {
vmSize: 'Standard_DS1_v2'
}
osProfile: {
computerName: vmName
adminUsername: adminUsername
adminPassword: adminPassword
}
}
}
51 changes: 51 additions & 0 deletions quickstarts/vm-deployment-with-custom-config/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "12491878621769874842"
}
},
"parameters": {
"vmName": {
"type": "string",
"defaultValue": "myVM",
"metadata": {
"description": "The name of the virtual machine."
}
},
"adminUsername": {
"type": "string",
"defaultValue": "azureUser",
"metadata": {
"description": "The admin username for the VM."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "The admin password for the VM."
}
}
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2021-07-01",
"name": "[parameters('vmName')]",
"location": "[resourceGroup().location]",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_DS1_v2"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
}
}
}
]
}
12 changes: 12 additions & 0 deletions quickstarts/vm-deployment-with-custom-config/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/metadata.json#",
"itemDisplayName": "Virtual Machine Deployment with Custom Config",
"description": "Deploys a virtual machine with a custom configuration using Azure Bicep.",
"summary": "Deploy a virtual machine with custom configurations using Azure Bicep.",
"githubUsername": "YourGitHubUsername",
"docOwner": "YourGitHubUsername",
"dateUpdated": "2024-12-12",
"type": "QuickStart",
"validationType": "Manual"
}

Loading