From 05027db648008fc92239923da77ac549da2b3415 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 22:41:44 +0530 Subject: [PATCH 01/16] Adding VM Storage Enivornment --- .github/copilot-instructions.md | 1 + .../VMStorageConfig/environment.yaml | 59 +++++++++ .../BicepTemplates/VMStorageConfig/main.bicep | 119 ++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml create mode 100644 Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..bbf7972 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +- @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available. \ No newline at end of file diff --git a/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml b/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml new file mode 100644 index 0000000..1eebefa --- /dev/null +++ b/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml @@ -0,0 +1,59 @@ +name: VMStorageConfig +summary: Deployment of a Virtual Machine with a Storage Account using Bicep. +description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. +templatePath: main.bicep +parameters: +- id: "vmName" + name: "Virtual Machine Name" + description: "Name of the Virtual Machine to be deployed." + type: "string" + default: "myVM" +- id: "location" + name: "Location" + description: "Azure region where the resources will be deployed." + type: "string" + default: "[resourceGroup().location]" +- id: "adminUsername" + name: "Admin Username" + description: "Admin username for the Virtual Machine." + type: "string" + default: "azureuser" +- id: "adminPassword" + name: "Admin Password" + description: "Admin password for the Virtual Machine." + type: "securestring" +- id: "storageAccountName" + name: "Storage Account Name" + description: "Name of the Storage Account to be created." + type: "string" + default: "mystorageacct" +- id: "storageSku" + name: "Storage SKU" + description: "SKU for the Storage Account." + type: "string" + default: "Standard_LRS" + allowed: + - "Standard_LRS" + - "Standard_GRS" + - "Standard_ZRS" + - "Premium_LRS" +- id: "vmSize" + name: "Virtual Machine Size" + description: "Size of the Virtual Machine." + type: "string" + default: "Standard_DS1_v2" + allowed: + - "Standard_DS1_v2" + - "Standard_DS2_v2" + - "Standard_B1s" + - "Standard_B2s" +- id: "imageReference" + name: "OS Image Reference" + description: "Reference to the OS image for the Virtual Machine." + type: "object" + default: + publisher: "Canonical" + offer: "UbuntuServer" + sku: "18.04-LTS" + version: "latest" +runner: Bicep \ No newline at end of file diff --git a/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep b/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep new file mode 100644 index 0000000..7436fa5 --- /dev/null +++ b/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep @@ -0,0 +1,119 @@ +@description('Name of the Virtual Machine') +param vmName string + +@description('Location for all resources') +param location string = resourceGroup().location + +@description('Admin username for the Virtual Machine') +param adminUsername string + +@description('Admin password for the Virtual Machine') +@secure() +param adminPassword string + +@description('Name of the Storage Account') +param storageAccountName string + +@description('SKU for the Storage Account') +param storageSku string = 'Standard_LRS' + +@description('VM size') +param vmSize string = 'Standard_DS1_v2' + +@description('OS image reference') +param imageReference object = { + publisher: 'Canonical' + offer: 'UbuntuServer' + sku: '18.04-LTS' + version: 'latest' +} + +resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: storageAccountName + location: location + sku: { + name: storageSku + } + kind: 'StorageV2' +} + +resource virtualMachine 'Microsoft.Compute/virtualMachines@2022-08-01' = { + name: vmName + location: location + identity: { + type: 'SystemAssigned' + } + properties: { + hardwareProfile: { + vmSize: vmSize + } + osProfile: { + computerName: vmName + adminUsername: adminUsername + adminPassword: adminPassword + } + storageProfile: { + imageReference: imageReference + osDisk: { + createOption: 'FromImage' + managedDisk: { + storageAccountType: 'Standard_LRS' + } + } + } + networkProfile: { + networkInterfaces: [ + { + id: networkInterface.id + } + ] + } + } +} + +resource networkInterface 'Microsoft.Network/networkInterfaces@2022-09-01' = { + name: '${vmName}-nic' + location: location + properties: { + ipConfigurations: [ + { + name: 'ipconfig1' + properties: { + privateIPAllocationMethod: 'Dynamic' + subnet: { + id: virtualNetwork.properties.subnets[0].id + } + } + } + ] + } +} + +resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-09-01' = { + name: '${vmName}-vnet' + location: location + properties: { + addressSpace: { + addressPrefixes: [ + '10.0.0.0/16' + ] + } + subnets: [ + { + name: 'default' + properties: { + addressPrefix: '10.0.0.0/24' + } + } + ] + } +} + +resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(virtualMachine.id, 'Storage Blob Data Contributor') + properties: { + principalId: virtualMachine.identity.principalId + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') // Storage Blob Data Contributor + scope: storageAccount.id + } +} From 19f773a6d3bdd6641556228aabf409f19fd694e9 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 22:54:50 +0530 Subject: [PATCH 02/16] Adding ARM Templatize Version --- .../VMwithStorage-template/environment.yaml | 59 ++++++ .../VMwithStorage-template/main.json | 177 ++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml create mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml new file mode 100644 index 0000000..1eebefa --- /dev/null +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -0,0 +1,59 @@ +name: VMStorageConfig +summary: Deployment of a Virtual Machine with a Storage Account using Bicep. +description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. +templatePath: main.bicep +parameters: +- id: "vmName" + name: "Virtual Machine Name" + description: "Name of the Virtual Machine to be deployed." + type: "string" + default: "myVM" +- id: "location" + name: "Location" + description: "Azure region where the resources will be deployed." + type: "string" + default: "[resourceGroup().location]" +- id: "adminUsername" + name: "Admin Username" + description: "Admin username for the Virtual Machine." + type: "string" + default: "azureuser" +- id: "adminPassword" + name: "Admin Password" + description: "Admin password for the Virtual Machine." + type: "securestring" +- id: "storageAccountName" + name: "Storage Account Name" + description: "Name of the Storage Account to be created." + type: "string" + default: "mystorageacct" +- id: "storageSku" + name: "Storage SKU" + description: "SKU for the Storage Account." + type: "string" + default: "Standard_LRS" + allowed: + - "Standard_LRS" + - "Standard_GRS" + - "Standard_ZRS" + - "Premium_LRS" +- id: "vmSize" + name: "Virtual Machine Size" + description: "Size of the Virtual Machine." + type: "string" + default: "Standard_DS1_v2" + allowed: + - "Standard_DS1_v2" + - "Standard_DS2_v2" + - "Standard_B1s" + - "Standard_B2s" +- id: "imageReference" + name: "OS Image Reference" + description: "Reference to the OS image for the Virtual Machine." + type: "object" + default: + publisher: "Canonical" + offer: "UbuntuServer" + sku: "18.04-LTS" + version: "latest" +runner: Bicep \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json new file mode 100644 index 0000000..72b18ef --- /dev/null +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json @@ -0,0 +1,177 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.34.44.8038", + "templateHash": "17124926074238084626" + } + }, + "parameters": { + "vmName": { + "type": "string", + "metadata": { + "description": "Name of the Virtual Machine" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Admin username for the Virtual Machine" + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Admin password for the Virtual Machine" + } + }, + "storageAccountName": { + "type": "string", + "metadata": { + "description": "Name of the Storage Account" + } + }, + "storageSku": { + "type": "string", + "defaultValue": "Standard_LRS", + "metadata": { + "description": "SKU for the Storage Account" + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_DS1_v2", + "metadata": { + "description": "VM size" + } + }, + "imageReference": { + "type": "object", + "defaultValue": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + }, + "metadata": { + "description": "OS image reference" + } + } + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2022-09-01", + "name": "[parameters('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageSku')]" + }, + "kind": "StorageV2" + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2022-08-01", + "name": "[parameters('vmName')]", + "location": "[parameters('location')]", + "identity": { + "type": "SystemAssigned" + }, + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": { + "computerName": "[parameters('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": "[parameters('imageReference')]", + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Standard_LRS" + } + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" + } + ] + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" + ] + }, + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2022-09-01", + "name": "[format('{0}-nic', parameters('vmName'))]", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[reference(resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName'))), '2022-09-01').subnets[0].id]" + } + } + } + ] + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName')))]" + ] + }, + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2022-09-01", + "name": "[format('{0}-vnet', parameters('vmName'))]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "10.0.0.0/16" + ] + }, + "subnets": [ + { + "name": "default", + "properties": { + "addressPrefix": "10.0.0.0/24" + } + } + ] + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2022-04-01", + "name": "[guid(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), 'Storage Blob Data Contributor')]", + "properties": { + "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2022-08-01', 'full').identity.principalId]", + "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", + "scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", + "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" + ] + } + ] +} \ No newline at end of file From 155d319777655232a3b44a393a8174660d4ed55b Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:05:40 +0530 Subject: [PATCH 03/16] Update environment.yaml --- .../VMwithStorage-template/environment.yaml | 56 +------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 1eebefa..27e051c 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,59 +1,5 @@ name: VMStorageConfig summary: Deployment of a Virtual Machine with a Storage Account using Bicep. description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. +runner: ARM templatePath: main.bicep -parameters: -- id: "vmName" - name: "Virtual Machine Name" - description: "Name of the Virtual Machine to be deployed." - type: "string" - default: "myVM" -- id: "location" - name: "Location" - description: "Azure region where the resources will be deployed." - type: "string" - default: "[resourceGroup().location]" -- id: "adminUsername" - name: "Admin Username" - description: "Admin username for the Virtual Machine." - type: "string" - default: "azureuser" -- id: "adminPassword" - name: "Admin Password" - description: "Admin password for the Virtual Machine." - type: "securestring" -- id: "storageAccountName" - name: "Storage Account Name" - description: "Name of the Storage Account to be created." - type: "string" - default: "mystorageacct" -- id: "storageSku" - name: "Storage SKU" - description: "SKU for the Storage Account." - type: "string" - default: "Standard_LRS" - allowed: - - "Standard_LRS" - - "Standard_GRS" - - "Standard_ZRS" - - "Premium_LRS" -- id: "vmSize" - name: "Virtual Machine Size" - description: "Size of the Virtual Machine." - type: "string" - default: "Standard_DS1_v2" - allowed: - - "Standard_DS1_v2" - - "Standard_DS2_v2" - - "Standard_B1s" - - "Standard_B2s" -- id: "imageReference" - name: "OS Image Reference" - description: "Reference to the OS image for the Virtual Machine." - type: "object" - default: - publisher: "Canonical" - offer: "UbuntuServer" - sku: "18.04-LTS" - version: "latest" -runner: Bicep \ No newline at end of file From 10728dd690734c97f7ed032e7aafe34baab8c245 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:11:34 +0530 Subject: [PATCH 04/16] Fixing the Minor Changes --- .../VMwithStorage-template/environment.yaml | 2 +- .../VMwithStorage-template/main.json | 177 ------------------ 2 files changed, 1 insertion(+), 178 deletions(-) delete mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 27e051c..bc0443a 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -2,4 +2,4 @@ name: VMStorageConfig summary: Deployment of a Virtual Machine with a Storage Account using Bicep. description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. runner: ARM -templatePath: main.bicep +templatePath: azuredeploy.json diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json deleted file mode 100644 index 72b18ef..0000000 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/main.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "17124926074238084626" - } - }, - "parameters": { - "vmName": { - "type": "string", - "metadata": { - "description": "Name of the Virtual Machine" - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "Location for all resources" - } - }, - "adminUsername": { - "type": "string", - "metadata": { - "description": "Admin username for the Virtual Machine" - } - }, - "adminPassword": { - "type": "securestring", - "metadata": { - "description": "Admin password for the Virtual Machine" - } - }, - "storageAccountName": { - "type": "string", - "metadata": { - "description": "Name of the Storage Account" - } - }, - "storageSku": { - "type": "string", - "defaultValue": "Standard_LRS", - "metadata": { - "description": "SKU for the Storage Account" - } - }, - "vmSize": { - "type": "string", - "defaultValue": "Standard_DS1_v2", - "metadata": { - "description": "VM size" - } - }, - "imageReference": { - "type": "object", - "defaultValue": { - "publisher": "Canonical", - "offer": "UbuntuServer", - "sku": "18.04-LTS", - "version": "latest" - }, - "metadata": { - "description": "OS image reference" - } - } - }, - "resources": [ - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2022-09-01", - "name": "[parameters('storageAccountName')]", - "location": "[parameters('location')]", - "sku": { - "name": "[parameters('storageSku')]" - }, - "kind": "StorageV2" - }, - { - "type": "Microsoft.Compute/virtualMachines", - "apiVersion": "2022-08-01", - "name": "[parameters('vmName')]", - "location": "[parameters('location')]", - "identity": { - "type": "SystemAssigned" - }, - "properties": { - "hardwareProfile": { - "vmSize": "[parameters('vmSize')]" - }, - "osProfile": { - "computerName": "[parameters('vmName')]", - "adminUsername": "[parameters('adminUsername')]", - "adminPassword": "[parameters('adminPassword')]" - }, - "storageProfile": { - "imageReference": "[parameters('imageReference')]", - "osDisk": { - "createOption": "FromImage", - "managedDisk": { - "storageAccountType": "Standard_LRS" - } - } - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" - } - ] - } - }, - "dependsOn": [ - "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" - ] - }, - { - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2022-09-01", - "name": "[format('{0}-nic', parameters('vmName'))]", - "location": "[parameters('location')]", - "properties": { - "ipConfigurations": [ - { - "name": "ipconfig1", - "properties": { - "privateIPAllocationMethod": "Dynamic", - "subnet": { - "id": "[reference(resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName'))), '2022-09-01').subnets[0].id]" - } - } - } - ] - }, - "dependsOn": [ - "[resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName')))]" - ] - }, - { - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2022-09-01", - "name": "[format('{0}-vnet', parameters('vmName'))]", - "location": "[parameters('location')]", - "properties": { - "addressSpace": { - "addressPrefixes": [ - "10.0.0.0/16" - ] - }, - "subnets": [ - { - "name": "default", - "properties": { - "addressPrefix": "10.0.0.0/24" - } - } - ] - } - }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "2022-04-01", - "name": "[guid(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), 'Storage Blob Data Contributor')]", - "properties": { - "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2022-08-01', 'full').identity.principalId]", - "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" - }, - "dependsOn": [ - "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", - "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" - ] - } - ] -} \ No newline at end of file From 463207d76f5afde79c89fa3c42801aec2331848d Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:15:00 +0530 Subject: [PATCH 05/16] Fixing the commit message --- .../VMwithStorage-template/azuredeploy.json | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json new file mode 100644 index 0000000..72b18ef --- /dev/null +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json @@ -0,0 +1,177 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.34.44.8038", + "templateHash": "17124926074238084626" + } + }, + "parameters": { + "vmName": { + "type": "string", + "metadata": { + "description": "Name of the Virtual Machine" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Admin username for the Virtual Machine" + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Admin password for the Virtual Machine" + } + }, + "storageAccountName": { + "type": "string", + "metadata": { + "description": "Name of the Storage Account" + } + }, + "storageSku": { + "type": "string", + "defaultValue": "Standard_LRS", + "metadata": { + "description": "SKU for the Storage Account" + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_DS1_v2", + "metadata": { + "description": "VM size" + } + }, + "imageReference": { + "type": "object", + "defaultValue": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + }, + "metadata": { + "description": "OS image reference" + } + } + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2022-09-01", + "name": "[parameters('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageSku')]" + }, + "kind": "StorageV2" + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2022-08-01", + "name": "[parameters('vmName')]", + "location": "[parameters('location')]", + "identity": { + "type": "SystemAssigned" + }, + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": { + "computerName": "[parameters('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": "[parameters('imageReference')]", + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Standard_LRS" + } + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" + } + ] + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" + ] + }, + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2022-09-01", + "name": "[format('{0}-nic', parameters('vmName'))]", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[reference(resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName'))), '2022-09-01').subnets[0].id]" + } + } + } + ] + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName')))]" + ] + }, + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2022-09-01", + "name": "[format('{0}-vnet', parameters('vmName'))]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "10.0.0.0/16" + ] + }, + "subnets": [ + { + "name": "default", + "properties": { + "addressPrefix": "10.0.0.0/24" + } + } + ] + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2022-04-01", + "name": "[guid(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), 'Storage Blob Data Contributor')]", + "properties": { + "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2022-08-01', 'full').identity.principalId]", + "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", + "scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", + "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" + ] + } + ] +} \ No newline at end of file From 8f50d8b9ec74217f76a58ef589bfe5d81afc1e7a Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:19:26 +0530 Subject: [PATCH 06/16] Minor error fix --- .../ARMTemplates/VMwithStorage-template/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index bc0443a..8dccbac 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,4 +1,4 @@ -name: VMStorageConfig +name: VMwithStorage-template summary: Deployment of a Virtual Machine with a Storage Account using Bicep. description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. runner: ARM From 1b777b7e8703a4339111a9d7a9d13b7b48ca5dbc Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:21:31 +0530 Subject: [PATCH 07/16] Update environment.yaml --- .../ARMTemplates/VMwithStorage-template/environment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 8dccbac..440999e 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,5 +1,5 @@ name: VMwithStorage-template -summary: Deployment of a Virtual Machine with a Storage Account using Bicep. -description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. +summary: Deployment of a Virtual Machine with a Storage Account. +description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account. runner: ARM templatePath: azuredeploy.json From 3fac3ed659ee552d10ce7957447d2ae9c503a09f Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:25:28 +0530 Subject: [PATCH 08/16] Fixing Env file --- .../VMwithStorage-template/environment.yaml | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 8dccbac..7af7f45 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,5 +1,59 @@ name: VMwithStorage-template -summary: Deployment of a Virtual Machine with a Storage Account using Bicep. +summary: Deployment of a Virtual Machine with a Storage Account using an ARM template. description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. -runner: ARM templatePath: azuredeploy.json +parameters: +- id: "vmName" + name: "Virtual Machine Name" + description: "Name of the Virtual Machine to be deployed." + type: "string" + default: "myVM" +- id: "location" + name: "Location" + description: "Azure region where the resources will be deployed." + type: "string" + default: "[resourceGroup().location]" +- id: "adminUsername" + name: "Admin Username" + description: "Admin username for the Virtual Machine." + type: "string" + default: "azureuser" +- id: "adminPassword" + name: "Admin Password" + description: "Admin password for the Virtual Machine." + type: "securestring" +- id: "storageAccountName" + name: "Storage Account Name" + description: "Name of the Storage Account to be created." + type: "string" + default: "mystorageacct" +- id: "storageSku" + name: "Storage SKU" + description: "SKU for the Storage Account." + type: "string" + default: "Standard_LRS" + allowed: + - "Standard_LRS" + - "Standard_GRS" + - "Standard_ZRS" + - "Premium_LRS" +- id: "vmSize" + name: "Virtual Machine Size" + description: "Size of the Virtual Machine." + type: "string" + default: "Standard_DS1_v2" + allowed: + - "Standard_DS1_v2" + - "Standard_DS2_v2" + - "Standard_B1s" + - "Standard_B2s" +- id: "imageReference" + name: "OS Image Reference" + description: "Reference to the OS image for the Virtual Machine." + type: "object" + default: + publisher: "Canonical" + offer: "UbuntuServer" + sku: "18.04-LTS" + version: "latest" +runner: ARM \ No newline at end of file From 8eed0aa7bee63c7a064d9c5ff630a4237856864f Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Tue, 15 Apr 2025 23:26:44 +0530 Subject: [PATCH 09/16] Commit From 45c785b66b474ab93391d018fe7f90297b080fa1 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 11:19:28 +0530 Subject: [PATCH 10/16] Updating the files for ARM template --- .../VMwithStorage-template/azuredeploy.json | 247 ++++++++++-------- .../azuredeploy.parameters.json | 12 + .../VMwithStorage-template/environment.yaml | 99 +++---- 3 files changed, 189 insertions(+), 169 deletions(-) create mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json index 72b18ef..2517a7e 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json @@ -1,177 +1,204 @@ { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "17124926074238084626" - } - }, "parameters": { "vmName": { "type": "string", + "defaultValue": "myVM", "metadata": { - "description": "Name of the Virtual Machine" - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "Location for all resources" + "description": "Name of the Virtual Machine." } }, "adminUsername": { "type": "string", "metadata": { - "description": "Admin username for the Virtual Machine" + "description": "Admin username for the VM." } }, "adminPassword": { - "type": "securestring", + "type": "secureString", "metadata": { - "description": "Admin password for the Virtual Machine" + "description": "Admin password for the VM." } }, - "storageAccountName": { - "type": "string", - "metadata": { - "description": "Name of the Storage Account" - } - }, - "storageSku": { - "type": "string", - "defaultValue": "Standard_LRS", - "metadata": { - "description": "SKU for the Storage Account" - } - }, - "vmSize": { + "location": { "type": "string", - "defaultValue": "Standard_DS1_v2", - "metadata": { - "description": "VM size" - } - }, - "imageReference": { - "type": "object", - "defaultValue": { - "publisher": "Canonical", - "offer": "UbuntuServer", - "sku": "18.04-LTS", - "version": "latest" - }, + "defaultValue": "[resourceGroup().location]", "metadata": { - "description": "OS image reference" + "description": "Location for all resources." } } }, + "variables": { + "storageAccountName": "[toLower(concat('st', uniqueString(resourceGroup().id)))]", + "vnetName": "myVNet", + "subnetName": "mySubnet", + "nicName": "myNic", + "publicIpName": "myPublicIP", + "nsgName": "myNSG", + "vmIdentityName": "[concat(parameters('vmName'), '-identity')]" + }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-09-01", - "name": "[parameters('storageAccountName')]", + "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", "sku": { - "name": "[parameters('storageSku')]" + "name": "Standard_LRS" }, - "kind": "StorageV2" + "kind": "StorageV2", + "properties": {} }, { - "type": "Microsoft.Compute/virtualMachines", - "apiVersion": "2022-08-01", - "name": "[parameters('vmName')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2022-07-01", + "name": "[variables('vnetName')]", "location": "[parameters('location')]", - "identity": { - "type": "SystemAssigned" - }, "properties": { - "hardwareProfile": { - "vmSize": "[parameters('vmSize')]" - }, - "osProfile": { - "computerName": "[parameters('vmName')]", - "adminUsername": "[parameters('adminUsername')]", - "adminPassword": "[parameters('adminPassword')]" + "addressSpace": { + "addressPrefixes": [ + "10.0.0.0/16" + ] }, - "storageProfile": { - "imageReference": "[parameters('imageReference')]", - "osDisk": { - "createOption": "FromImage", - "managedDisk": { - "storageAccountType": "Standard_LRS" + "subnets": [ + { + "name": "[variables('subnetName')]", + "properties": { + "addressPrefix": "10.0.0.0/24" } } - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" + ] + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2022-07-01", + "name": "[variables('nsgName')]", + "location": "[parameters('location')]", + "properties": { + "securityRules": [ + { + "name": "default-allow-ssh", + "properties": { + "priority": 1000, + "protocol": "Tcp", + "access": "Allow", + "direction": "Inbound", + "sourceAddressPrefix": "*", + "sourcePortRange": "*", + "destinationAddressPrefix": "*", + "destinationPortRange": "22" } - ] - } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "apiVersion": "2022-07-01", + "name": "[variables('publicIpName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Basic" }, - "dependsOn": [ - "[resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic', parameters('vmName')))]" - ] + "properties": { + "publicIPAllocationMethod": "Dynamic" + } }, { "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2022-09-01", - "name": "[format('{0}-nic', parameters('vmName'))]", + "apiVersion": "2022-07-01", + "name": "[variables('nicName')]", "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]", + "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { - "privateIPAllocationMethod": "Dynamic", "subnet": { - "id": "[reference(resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName'))), '2022-09-01').subnets[0].id]" + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetName'), variables('subnetName'))]" + }, + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]" } } } - ] - }, - "dependsOn": [ - "[resourceId('Microsoft.Network/virtualNetworks', format('{0}-vnet', parameters('vmName')))]" - ] + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + } + } }, { - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2022-09-01", - "name": "[format('{0}-vnet', parameters('vmName'))]", + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2023-03-01", + "name": "[parameters('vmName')]", "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" + ], + "identity": { + "type": "SystemAssigned" + }, "properties": { - "addressSpace": { - "addressPrefixes": [ - "10.0.0.0/16" - ] + "hardwareProfile": { + "vmSize": "Standard_DS1_v2" }, - "subnets": [ - { - "name": "default", - "properties": { - "addressPrefix": "10.0.0.0/24" - } + "osProfile": { + "computerName": "[parameters('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "MicrosoftWindowsServer", + "offer": "WindowsServer", + "sku": "2019-Datacenter", + "version": "latest" + }, + "osDisk": { + "createOption": "FromImage" } - ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" + } + ] + } } }, { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", - "name": "[guid(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), 'Storage Blob Data Contributor')]", + "name": "[guid(resourceGroup().id, variables('storageAccountName'), parameters('vmName'), 'StorageBlobDataContributor')]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" + ], "properties": { - "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2022-08-01', 'full').identity.principalId]", "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" - }, - "dependsOn": [ - "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", - "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" - ] + "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2023-03-01', 'Full').identity.principalId]", + "scope": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" + } + } + ], + "outputs": { + "storageAccountName": { + "type": "string", + "value": "[variables('storageAccountName')]" + }, + "vmName": { + "type": "string", + "value": "[parameters('vmName')]" } - ] + } } \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json new file mode 100644 index 0000000..0f37229 --- /dev/null +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "value": "admin" // TODO: Fill in parameter value + }, + "adminPassword": { + "value": "Passw0rd8484" // TODO: Fill in parameter value + } + } +} \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index dd7e5e3..ca6f599 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,60 +1,41 @@ -name: VMwithStorage-template -summary: Deployment of a Virtual Machine with a Storage Account using Bicep. -description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. -runner: ARM -templatePath: azuredeploy.json +name: vm-with-storage +resourceType: Microsoft.Resources/deployments +location: [resourceGroup().location] parameters: -- id: "vmName" - name: "Virtual Machine Name" - description: "Name of the Virtual Machine to be deployed." - type: "string" - default: "myVM" -- id: "location" - name: "Location" - description: "Azure region where the resources will be deployed." - type: "string" - default: "[resourceGroup().location]" -- id: "adminUsername" - name: "Admin Username" - description: "Admin username for the Virtual Machine." - type: "string" - default: "azureuser" -- id: "adminPassword" - name: "Admin Password" - description: "Admin password for the Virtual Machine." - type: "securestring" -- id: "storageAccountName" - name: "Storage Account Name" - description: "Name of the Storage Account to be created." - type: "string" - default: "mystorageacct" -- id: "storageSku" - name: "Storage SKU" - description: "SKU for the Storage Account." - type: "string" - default: "Standard_LRS" - allowed: - - "Standard_LRS" - - "Standard_GRS" - - "Standard_ZRS" - - "Premium_LRS" -- id: "vmSize" - name: "Virtual Machine Size" - description: "Size of the Virtual Machine." - type: "string" - default: "Standard_DS1_v2" - allowed: - - "Standard_DS1_v2" - - "Standard_DS2_v2" - - "Standard_B1s" - - "Standard_B2s" -- id: "imageReference" - name: "OS Image Reference" - description: "Reference to the OS image for the Virtual Machine." - type: "object" - default: - publisher: "Canonical" - offer: "UbuntuServer" - sku: "18.04-LTS" - version: "latest" -runner: ARM \ No newline at end of file + adminUsername: + type: string + description: Admin username for the VM + adminPassword: + type: securestring + description: Admin password for the VM + vmName: + type: string + description: Name of the virtual machine + vmSize: + type: string + default: Standard_DS1_v2 + description: Size of the virtual machine + storageAccountType: + type: string + default: Standard_LRS + description: Type of storage account + osDiskSizeGB: + type: int + default: 128 + description: Size of the OS disk in GB +template: + file: azuredeploy.json + parameters: + adminUsername: $(adminUsername) + adminPassword: $(adminPassword) + vmName: $(vmName) + vmSize: $(vmSize) + storageAccountType: $(storageAccountType) + osDiskSizeGB: $(osDiskSizeGB) +outputs: + vmId: + type: string + description: Resource ID of the deployed VM + publicIpAddress: + type: string + description: Public IP address of the VM \ No newline at end of file From f42544881ccad186f4e8e251c1be3da5bbf8ef90 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 11:40:40 +0530 Subject: [PATCH 11/16] Fixing Errors --- .../VMwithStorage-template/azuredeploy.json | 128 +++++------------- .../azuredeploy.parameters.json | 12 -- .../VMwithStorage-template/environment.yaml | 85 +++++++----- .../VMStorageConfig/environment.yaml | 59 -------- .../BicepTemplates/VMStorageConfig/main.bicep | 119 ---------------- 5 files changed, 84 insertions(+), 319 deletions(-) delete mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json delete mode 100644 Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml delete mode 100644 Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json index 2517a7e..c009580 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json @@ -1,49 +1,26 @@ { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", - "parameters": { - "vmName": { - "type": "string", - "defaultValue": "myVM", - "metadata": { - "description": "Name of the Virtual Machine." - } - }, - "adminUsername": { - "type": "string", - "metadata": { - "description": "Admin username for the VM." - } - }, - "adminPassword": { - "type": "secureString", - "metadata": { - "description": "Admin password for the VM." - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "Location for all resources." - } - } - }, + "parameters": {}, "variables": { - "storageAccountName": "[toLower(concat('st', uniqueString(resourceGroup().id)))]", - "vnetName": "myVNet", + "location": "[resourceGroup().location]", + "vmName": "myVM", + "storageAccountName": "[toLower(concat('stor', uniqueString(resourceGroup().id)))]", + "vnetName": "myVnet", "subnetName": "mySubnet", "nicName": "myNic", - "publicIpName": "myPublicIP", - "nsgName": "myNSG", - "vmIdentityName": "[concat(parameters('vmName'), '-identity')]" + "addressPrefix": "10.0.0.0/16", + "subnetPrefix": "10.0.0.0/24", + "adminUsername": "azureuser", + "adminPassword": "P@ssw0rd1234!", + "roleAssignmentGuid": "[guid(concat('roleAssignment', variables('vmName'), variables('storageAccountName')))]" }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-09-01", "name": "[variables('storageAccountName')]", - "location": "[parameters('location')]", + "location": "[variables('location')]", "sku": { "name": "Standard_LRS" }, @@ -54,67 +31,30 @@ "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2022-07-01", "name": "[variables('vnetName')]", - "location": "[parameters('location')]", + "location": "[variables('location')]", "properties": { "addressSpace": { "addressPrefixes": [ - "10.0.0.0/16" + "[variables('addressPrefix')]" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { - "addressPrefix": "10.0.0.0/24" - } - } - ] - } - }, - { - "type": "Microsoft.Network/networkSecurityGroups", - "apiVersion": "2022-07-01", - "name": "[variables('nsgName')]", - "location": "[parameters('location')]", - "properties": { - "securityRules": [ - { - "name": "default-allow-ssh", - "properties": { - "priority": 1000, - "protocol": "Tcp", - "access": "Allow", - "direction": "Inbound", - "sourceAddressPrefix": "*", - "sourcePortRange": "*", - "destinationAddressPrefix": "*", - "destinationPortRange": "22" + "addressPrefix": "[variables('subnetPrefix')]" } } ] } }, - { - "type": "Microsoft.Network/publicIPAddresses", - "apiVersion": "2022-07-01", - "name": "[variables('publicIpName')]", - "location": "[parameters('location')]", - "sku": { - "name": "Basic" - }, - "properties": { - "publicIPAllocationMethod": "Dynamic" - } - }, { "type": "Microsoft.Network/networkInterfaces", "apiVersion": "2022-07-01", "name": "[variables('nicName')]", - "location": "[parameters('location')]", + "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]", - "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]" ], "properties": { "ipConfigurations": [ @@ -124,23 +64,17 @@ "subnet": { "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetName'), variables('subnetName'))]" }, - "privateIPAllocationMethod": "Dynamic", - "publicIPAddress": { - "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]" - } + "privateIPAllocationMethod": "Dynamic" } } - ], - "networkSecurityGroup": { - "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" - } + ] } }, { "type": "Microsoft.Compute/virtualMachines", "apiVersion": "2023-03-01", - "name": "[parameters('vmName')]", - "location": "[parameters('location')]", + "name": "[variables('vmName')]", + "location": "[variables('location')]", "dependsOn": [ "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" ], @@ -149,12 +83,12 @@ }, "properties": { "hardwareProfile": { - "vmSize": "Standard_DS1_v2" + "vmSize": "Standard_B1s" }, "osProfile": { - "computerName": "[parameters('vmName')]", - "adminUsername": "[parameters('adminUsername')]", - "adminPassword": "[parameters('adminPassword')]" + "computerName": "[variables('vmName')]", + "adminUsername": "[variables('adminUsername')]", + "adminPassword": "[variables('adminPassword')]" }, "storageProfile": { "imageReference": { @@ -179,26 +113,26 @@ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", - "name": "[guid(resourceGroup().id, variables('storageAccountName'), parameters('vmName'), 'StorageBlobDataContributor')]", + "name": "[variables('roleAssignmentGuid')]", "dependsOn": [ - "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]", + "[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ], "properties": { "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), '2023-03-01', 'Full').identity.principalId]", + "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', variables('vmName')), '2023-03-01', 'Full').identity.principalId]", "scope": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" } } ], "outputs": { - "storageAccountName": { + "vmName": { "type": "string", - "value": "[variables('storageAccountName')]" + "value": "[variables('vmName')]" }, - "vmName": { + "storageAccountName": { "type": "string", - "value": "[parameters('vmName')]" + "value": "[variables('storageAccountName')]" } } } \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json deleted file mode 100644 index 0f37229..0000000 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.parameters.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "adminUsername": { - "value": "admin" // TODO: Fill in parameter value - }, - "adminPassword": { - "value": "Passw0rd8484" // TODO: Fill in parameter value - } - } -} \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index ca6f599..465bbba 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,41 +1,62 @@ -name: vm-with-storage -resourceType: Microsoft.Resources/deployments -location: [resourceGroup().location] parameters: - adminUsername: + - id: vmName type: string - description: Admin username for the VM - adminPassword: + description: Name of the Virtual Machine + + - id: adminUsername + type: string + description: Admin username for the Virtual Machine + + - id: adminPassword type: securestring - description: Admin password for the VM - vmName: + description: Admin password for the Virtual Machine + + - id: location + type: string + description: Azure region for deployment + allowed: + - eastus + - westus + - westeurope + - southeastasia + + - id: storageAccountType type: string - description: Name of the virtual machine - vmSize: + description: Type of storage account + allowed: + - Standard_LRS + - Standard_GRS + - Standard_ZRS + - Premium_LRS + + - id: vmSize type: string + description: Size of the Virtual Machine default: Standard_DS1_v2 - description: Size of the virtual machine - storageAccountType: + + - id: osType type: string - default: Standard_LRS - description: Type of storage account - osDiskSizeGB: + description: Operating system type + allowed: + - Windows + - Linux + + - id: diskSizeGB type: int - default: 128 description: Size of the OS disk in GB -template: - file: azuredeploy.json - parameters: - adminUsername: $(adminUsername) - adminPassword: $(adminPassword) - vmName: $(vmName) - vmSize: $(vmSize) - storageAccountType: $(storageAccountType) - osDiskSizeGB: $(osDiskSizeGB) -outputs: - vmId: - type: string - description: Resource ID of the deployed VM - publicIpAddress: - type: string - description: Public IP address of the VM \ No newline at end of file + default: 128 + + - id: vnetName + type: string + description: Name of the Virtual Network + + - id: subnetName + type: string + description: Name of the Subnet + + - id: publicIpAddressType + type: string + description: Public IP address allocation method + allowed: + - Dynamic + - Static \ No newline at end of file diff --git a/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml b/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml deleted file mode 100644 index 1eebefa..0000000 --- a/Environment-Definitions/BicepTemplates/VMStorageConfig/environment.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: VMStorageConfig -summary: Deployment of a Virtual Machine with a Storage Account using Bicep. -description: Deploys a Virtual Machine with a System-Assigned Managed Identity, a Storage Account, a Virtual Network, and a Network Interface. Assigns the VM the "Storage Blob Data Contributor" role for the Storage Account. -templatePath: main.bicep -parameters: -- id: "vmName" - name: "Virtual Machine Name" - description: "Name of the Virtual Machine to be deployed." - type: "string" - default: "myVM" -- id: "location" - name: "Location" - description: "Azure region where the resources will be deployed." - type: "string" - default: "[resourceGroup().location]" -- id: "adminUsername" - name: "Admin Username" - description: "Admin username for the Virtual Machine." - type: "string" - default: "azureuser" -- id: "adminPassword" - name: "Admin Password" - description: "Admin password for the Virtual Machine." - type: "securestring" -- id: "storageAccountName" - name: "Storage Account Name" - description: "Name of the Storage Account to be created." - type: "string" - default: "mystorageacct" -- id: "storageSku" - name: "Storage SKU" - description: "SKU for the Storage Account." - type: "string" - default: "Standard_LRS" - allowed: - - "Standard_LRS" - - "Standard_GRS" - - "Standard_ZRS" - - "Premium_LRS" -- id: "vmSize" - name: "Virtual Machine Size" - description: "Size of the Virtual Machine." - type: "string" - default: "Standard_DS1_v2" - allowed: - - "Standard_DS1_v2" - - "Standard_DS2_v2" - - "Standard_B1s" - - "Standard_B2s" -- id: "imageReference" - name: "OS Image Reference" - description: "Reference to the OS image for the Virtual Machine." - type: "object" - default: - publisher: "Canonical" - offer: "UbuntuServer" - sku: "18.04-LTS" - version: "latest" -runner: Bicep \ No newline at end of file diff --git a/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep b/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep deleted file mode 100644 index 7436fa5..0000000 --- a/Environment-Definitions/BicepTemplates/VMStorageConfig/main.bicep +++ /dev/null @@ -1,119 +0,0 @@ -@description('Name of the Virtual Machine') -param vmName string - -@description('Location for all resources') -param location string = resourceGroup().location - -@description('Admin username for the Virtual Machine') -param adminUsername string - -@description('Admin password for the Virtual Machine') -@secure() -param adminPassword string - -@description('Name of the Storage Account') -param storageAccountName string - -@description('SKU for the Storage Account') -param storageSku string = 'Standard_LRS' - -@description('VM size') -param vmSize string = 'Standard_DS1_v2' - -@description('OS image reference') -param imageReference object = { - publisher: 'Canonical' - offer: 'UbuntuServer' - sku: '18.04-LTS' - version: 'latest' -} - -resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: storageAccountName - location: location - sku: { - name: storageSku - } - kind: 'StorageV2' -} - -resource virtualMachine 'Microsoft.Compute/virtualMachines@2022-08-01' = { - name: vmName - location: location - identity: { - type: 'SystemAssigned' - } - properties: { - hardwareProfile: { - vmSize: vmSize - } - osProfile: { - computerName: vmName - adminUsername: adminUsername - adminPassword: adminPassword - } - storageProfile: { - imageReference: imageReference - osDisk: { - createOption: 'FromImage' - managedDisk: { - storageAccountType: 'Standard_LRS' - } - } - } - networkProfile: { - networkInterfaces: [ - { - id: networkInterface.id - } - ] - } - } -} - -resource networkInterface 'Microsoft.Network/networkInterfaces@2022-09-01' = { - name: '${vmName}-nic' - location: location - properties: { - ipConfigurations: [ - { - name: 'ipconfig1' - properties: { - privateIPAllocationMethod: 'Dynamic' - subnet: { - id: virtualNetwork.properties.subnets[0].id - } - } - } - ] - } -} - -resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-09-01' = { - name: '${vmName}-vnet' - location: location - properties: { - addressSpace: { - addressPrefixes: [ - '10.0.0.0/16' - ] - } - subnets: [ - { - name: 'default' - properties: { - addressPrefix: '10.0.0.0/24' - } - } - ] - } -} - -resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(virtualMachine.id, 'Storage Blob Data Contributor') - properties: { - principalId: virtualMachine.identity.principalId - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') // Storage Blob Data Contributor - scope: storageAccount.id - } -} From a5581d666fd62f06a1a11ebe220d80b7dac5a023 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 11:43:10 +0530 Subject: [PATCH 12/16] Fixing Errors --- .../ARMTemplates/VMwithStorage-template/environment.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 465bbba..d6bfebc 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -1,3 +1,11 @@ +# yaml-language-server: $schema=https://github.com/Azure/deployment-environments/releases/download/2022-11-11-preview/manifest.schema.json +name: VmwithStorage-template +version: 1.0.0 +summary: Azure VM and Storage Environment +description: Deploys an Azure VM with Storage, it is compatible with azd. +runner: ARM +templatePath: azuredeploy.json + parameters: - id: vmName type: string From ebad6894bb810324f0d5aee453447d0d00ba9d95 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 11:50:03 +0530 Subject: [PATCH 13/16] Fixing Errors --- .../ARMTemplates/VMwithStorage-template/environment.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index d6bfebc..cb200a2 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -67,4 +67,8 @@ parameters: description: Public IP address allocation method allowed: - Dynamic - - Static \ No newline at end of file + - Static + + - id: resourceGroup + type: string + description: Name of the resource group to deploy resources into \ No newline at end of file From 370ac789f0b33f7d3d1ce63e1be33e65a79eac23 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 12:01:19 +0530 Subject: [PATCH 14/16] Fixing Errors --- .../VMwithStorage-template/environment.yaml | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index cb200a2..0608f9b 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -10,6 +10,29 @@ parameters: - id: vmName type: string description: Name of the Virtual Machine + + - id: storageAccountName + type: string + description: Name of the Storage Account + + - id: vnetName + type: string + description: Name of the Virtual Network + + - id: subnetName + type: string + description: Name of the Subnet + + - id: nicName + type: string + description: Name of the Network Interface Card + + - id: addressPrefix + type: string + description: Address prefix for the Virtual Network + - id: subnetPrefix + type: string + description: Address prefix for the Subnet - id: adminUsername type: string @@ -28,15 +51,6 @@ parameters: - westeurope - southeastasia - - id: storageAccountType - type: string - description: Type of storage account - allowed: - - Standard_LRS - - Standard_GRS - - Standard_ZRS - - Premium_LRS - - id: vmSize type: string description: Size of the Virtual Machine @@ -54,14 +68,6 @@ parameters: description: Size of the OS disk in GB default: 128 - - id: vnetName - type: string - description: Name of the Virtual Network - - - id: subnetName - type: string - description: Name of the Subnet - - id: publicIpAddressType type: string description: Public IP address allocation method From dc4e831c6e48db4f035b48090f7048e91afe69e6 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 12:06:10 +0530 Subject: [PATCH 15/16] Fixing Errors --- .../VMwithStorage-template/environment.yaml | 75 +------------------ 1 file changed, 1 insertion(+), 74 deletions(-) diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml index 0608f9b..2a3520c 100644 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml @@ -4,77 +4,4 @@ version: 1.0.0 summary: Azure VM and Storage Environment description: Deploys an Azure VM with Storage, it is compatible with azd. runner: ARM -templatePath: azuredeploy.json - -parameters: - - id: vmName - type: string - description: Name of the Virtual Machine - - - id: storageAccountName - type: string - description: Name of the Storage Account - - - id: vnetName - type: string - description: Name of the Virtual Network - - - id: subnetName - type: string - description: Name of the Subnet - - - id: nicName - type: string - description: Name of the Network Interface Card - - - id: addressPrefix - type: string - description: Address prefix for the Virtual Network - - id: subnetPrefix - type: string - description: Address prefix for the Subnet - - - id: adminUsername - type: string - description: Admin username for the Virtual Machine - - - id: adminPassword - type: securestring - description: Admin password for the Virtual Machine - - - id: location - type: string - description: Azure region for deployment - allowed: - - eastus - - westus - - westeurope - - southeastasia - - - id: vmSize - type: string - description: Size of the Virtual Machine - default: Standard_DS1_v2 - - - id: osType - type: string - description: Operating system type - allowed: - - Windows - - Linux - - - id: diskSizeGB - type: int - description: Size of the OS disk in GB - default: 128 - - - id: publicIpAddressType - type: string - description: Public IP address allocation method - allowed: - - Dynamic - - Static - - - id: resourceGroup - type: string - description: Name of the resource group to deploy resources into \ No newline at end of file +templatePath: azuredeploy.json \ No newline at end of file From b4674e65696b284ad0d7b755bc8d0f02feea6bb7 Mon Sep 17 00:00:00 2001 From: Shiv Sharma Date: Wed, 16 Apr 2025 12:24:11 +0530 Subject: [PATCH 16/16] Deleted. --- .../VMwithStorage-template/azuredeploy.json | 138 ------------------ .../VMwithStorage-template/environment.yaml | 7 - 2 files changed, 145 deletions(-) delete mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json delete mode 100644 Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json b/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json deleted file mode 100644 index c009580..0000000 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/azuredeploy.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": {}, - "variables": { - "location": "[resourceGroup().location]", - "vmName": "myVM", - "storageAccountName": "[toLower(concat('stor', uniqueString(resourceGroup().id)))]", - "vnetName": "myVnet", - "subnetName": "mySubnet", - "nicName": "myNic", - "addressPrefix": "10.0.0.0/16", - "subnetPrefix": "10.0.0.0/24", - "adminUsername": "azureuser", - "adminPassword": "P@ssw0rd1234!", - "roleAssignmentGuid": "[guid(concat('roleAssignment', variables('vmName'), variables('storageAccountName')))]" - }, - "resources": [ - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2022-09-01", - "name": "[variables('storageAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_LRS" - }, - "kind": "StorageV2", - "properties": {} - }, - { - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2022-07-01", - "name": "[variables('vnetName')]", - "location": "[variables('location')]", - "properties": { - "addressSpace": { - "addressPrefixes": [ - "[variables('addressPrefix')]" - ] - }, - "subnets": [ - { - "name": "[variables('subnetName')]", - "properties": { - "addressPrefix": "[variables('subnetPrefix')]" - } - } - ] - } - }, - { - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2022-07-01", - "name": "[variables('nicName')]", - "location": "[variables('location')]", - "dependsOn": [ - "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]" - ], - "properties": { - "ipConfigurations": [ - { - "name": "ipconfig1", - "properties": { - "subnet": { - "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetName'), variables('subnetName'))]" - }, - "privateIPAllocationMethod": "Dynamic" - } - } - ] - } - }, - { - "type": "Microsoft.Compute/virtualMachines", - "apiVersion": "2023-03-01", - "name": "[variables('vmName')]", - "location": "[variables('location')]", - "dependsOn": [ - "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" - ], - "identity": { - "type": "SystemAssigned" - }, - "properties": { - "hardwareProfile": { - "vmSize": "Standard_B1s" - }, - "osProfile": { - "computerName": "[variables('vmName')]", - "adminUsername": "[variables('adminUsername')]", - "adminPassword": "[variables('adminPassword')]" - }, - "storageProfile": { - "imageReference": { - "publisher": "MicrosoftWindowsServer", - "offer": "WindowsServer", - "sku": "2019-Datacenter", - "version": "latest" - }, - "osDisk": { - "createOption": "FromImage" - } - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" - } - ] - } - } - }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "2022-04-01", - "name": "[variables('roleAssignmentGuid')]", - "dependsOn": [ - "[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]", - "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" - ], - "properties": { - "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "principalId": "[reference(resourceId('Microsoft.Compute/virtualMachines', variables('vmName')), '2023-03-01', 'Full').identity.principalId]", - "scope": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" - } - } - ], - "outputs": { - "vmName": { - "type": "string", - "value": "[variables('vmName')]" - }, - "storageAccountName": { - "type": "string", - "value": "[variables('storageAccountName')]" - } - } -} \ No newline at end of file diff --git a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml b/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml deleted file mode 100644 index 2a3520c..0000000 --- a/Environment-Definitions/ARMTemplates/VMwithStorage-template/environment.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# yaml-language-server: $schema=https://github.com/Azure/deployment-environments/releases/download/2022-11-11-preview/manifest.schema.json -name: VmwithStorage-template -version: 1.0.0 -summary: Azure VM and Storage Environment -description: Deploys an Azure VM with Storage, it is compatible with azd. -runner: ARM -templatePath: azuredeploy.json \ No newline at end of file