diff --git a/Allfiles/Interactive Lab Simulation Files/08/az104-08-configure_VMSS_disks.ps1 b/Allfiles/Interactive Lab Simulation Files/08/az104-08-configure_VMSS_disks.ps1 new file mode 100644 index 00000000..9495758e --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/08/az104-08-configure_VMSS_disks.ps1 @@ -0,0 +1,23 @@ +$rgName = 'az104-08-rg02' +$vmssName = 'az10408vmss0' +$vmss = Get-AzVmss ` + -ResourceGroupName $rgName ` + -VMScaleSetName $vmssName + +$publicSettings = @{ + "fileUris" = (,"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/prepare_vm_disks.ps1"); + "commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File prepare_vm_disks.ps1" +} + +Add-AzVmssExtension -VirtualMachineScaleSet $vmss ` + -Name "customScript" ` + -Publisher "Microsoft.Compute" ` + -Type "CustomScriptExtension" ` + -TypeHandlerVersion 1.8 ` + -Setting $publicSettings + +# Update the scale set and apply the Custom Script Extension to the VM instances +Update-AzVmss ` + -ResourceGroupName $rgName ` + -Name $vmssName ` + -VirtualMachineScaleSet $vmss \ No newline at end of file diff --git a/Allfiles/Interactive Lab Simulation Files/08/az104-08-custom_script_extension.json b/Allfiles/Interactive Lab Simulation Files/08/az104-08-custom_script_extension.json new file mode 100644 index 00000000..98a3e32b --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/08/az104-08-custom_script_extension.json @@ -0,0 +1,18 @@ + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "az104-08-vm1/customScriptExtension", + "apiVersion": "2018-06-01", + "location": "[resourceGroup().location]", + "dependsOn": [ + "az104-08-vm1" + ], + "properties": { + "publisher": "Microsoft.Compute", + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.7", + "autoUpgradeMinorVersion": true, + "settings": { + "commandToExecute": "powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\\inetpub\\wwwroot\\iisstart.htm' && powershell.exe Add-Content -Path 'C:\\inetpub\\wwwroot\\iisstart.htm' -Value $($env:computername)" + } + } + }, \ No newline at end of file diff --git a/Allfiles/Interactive Lab Simulation Files/08/az104-08-install_IIS.ps1 b/Allfiles/Interactive Lab Simulation Files/08/az104-08-install_IIS.ps1 new file mode 100644 index 00000000..055de7db --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/08/az104-08-install_IIS.ps1 @@ -0,0 +1,3 @@ +powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools +powershell.exe Remove-Item -Path 'C:\inetpub\wwwroot\iisstart.htm' +powershell.exe Add-Content -Path 'C:\inetpub\wwwroot\iisstart.htm' -Value "$env:computername" \ No newline at end of file diff --git a/Allfiles/Interactive Lab Simulation Files/08/lab08diskcode.txt b/Allfiles/Interactive Lab Simulation Files/08/lab08diskcode.txt new file mode 100644 index 00000000..b41765c3 --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/08/lab08diskcode.txt @@ -0,0 +1,7 @@ +New-StoragePool -FriendlyName storagepool1 -StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks (Get-PhysicalDisk -CanPool $true) + +New-VirtualDisk -StoragePoolFriendlyName storagepool1 -FriendlyName virtualdisk1 -Size 2046GB -ResiliencySettingName Simple -ProvisioningType Fixed + +Initialize-Disk -VirtualDisk (Get-VirtualDisk -FriendlyName virtualdisk1) + +New-Partition -DiskNumber 4 -UseMaximumSize -DriveLetter Z \ No newline at end of file diff --git a/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-parameters.json b/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-parameters.json new file mode 100644 index 00000000..fac1dbff --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-parameters.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "value": "Student" + }, + "vmNamePrefix": { + "value": "az104-10-vm" + }, + "nicNamePrefix": { + "value": "az104-10-nic" + }, + "imagePublisher": { + "value": "MicrosoftWindowsServer" + }, + "imageOffer": { + "value": "WindowsServer" + }, + "imageSKU": { + "value": "2019-Datacenter" + }, + "vmSize": { + "value": "Standard_D2s_v3" + }, + "virtualNetworkName": { + "value": "az104-10-vnet" + }, + "addressPrefix": { + "value": "10.0.0.0/24" + }, + "virtualNetworkResourceGroup": { + "value": "az104-10-rg0" + }, + "subnet0Name": { + "value": "subnet0" + }, + "subnet0Prefix": { + "value": "10.0.0.0/26" + } + } +} diff --git a/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-template.json b/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-template.json new file mode 100644 index 00000000..8168c06e --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/10/az104-10-vms-edge-template.json @@ -0,0 +1,280 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "type": "string", + "metadata": { + "description": "Admin username" + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Admin password" + } + }, + "vmNamePrefix": { + "type": "string", + "defaultValue": "az104-10-vm", + "metadata": { + "description": "VM name prefix" + } + }, + "pipNamePrefix": { + "type": "string", + "defaultValue": "az104-10-pip", + "metadata": { + "description": "Public IP address name prefix" + } + }, + "nicNamePrefix": { + "type": "string", + "defaultValue": "az104-10-nic", + "metadata": { + "description": "Nic name prefix" + } + }, + "imagePublisher": { + "type": "string", + "defaultValue": "MicrosoftWindowsServer", + "metadata": { + "description": "Image Publisher" + } + }, + "imageOffer": { + "type": "string", + "defaultValue": "WindowsServer", + "metadata": { + "description": "Image Offer" + } + }, + "imageSKU": { + "type": "string", + "defaultValue": "2019-Datacenter", + "allowedValues": [ + "2019-Datacenter", + "2019-Datacenter-Server-Core", + "2019-Datacenter-Server-Core-smalldisk" + ], + "metadata": { + "description": "Image SKU" + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_D2s_v3", + "metadata": { + "description": "VM size" + } + }, + "virtualNetworkName": { + "type": "string", + "defaultValue": "az104-10-vnet", + "metadata": { + "description": "Virtual network name" + } + }, + "addressPrefix": { + "type": "string", + "defaultValue": "10.0.0.0/24", + "metadata": { + "description": "Virtual network address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "defaultValue": "az104-10-rg0", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "subnet0Name": { + "type": "string", + "defaultValue": "subnet0", + "metadata": { + "description": "VNet first subnet name" + } + }, + "subnet0Prefix": { + "type": "string", + "defaultValue": "10.0.0.0/26", + "metadata": { + "description": "VNet first subnet prefix" + } + }, + "nsgName": { + "type": "string", + "defaultValue": "az104-10-nsg01", + "metadata": { + "description": "Network security group name" + } + } + }, + "variables": { + "vnetID": "[resourceId(parameters('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnet0Name'))]", + "numberOfInstances": 2, + "computeAPIVersion": "2018-10-01", + "networkAPIVersion": "2018-12-01" + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[concat(parameters('nicNamePrefix'), copyindex())]", + "apiVersion": "[variables('networkAPIVersion')]", + "location": "[resourceGroup().location]", + "copy": { + "name": "nicLoop", + "count": "[variables('numberOfInstances')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks/',parameters('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/',parameters('nsgName'))]", + "pipLoop" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[variables('subnetRef')]" + }, + "publicIpAddress": { + "id": "[resourceId('Microsoft.Network/publicIpAddresses',concat(parameters('pipNamePrefix'),copyindex()))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('nsgName'))]" + } + } + }, + { + "type": "Microsoft.Network/virtualNetworks", + "name": "[parameters('virtualNetworkName')]", + "apiVersion": "[variables('networkAPIVersion')]", + "location": "[resourceGroup().location]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnet0Name')]", + "properties": { + "addressPrefix": "[parameters('subnet0Prefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIpAddresses", + "name": "[concat(parameters('pipNamePrefix'), copyindex())]", + "apiVersion": "[variables('networkApiVersion')]", + "copy": { + "name": "pipLoop", + "count": "[variables('numberOfInstances')]" + }, + "location": "[resourceGroup().location]", + "properties": { + "publicIpAllocationMethod": "Dynamic" + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[parameters('nsgName')]", + "apiVersion": "[variables('networkApiVersion')]", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "default-allow-rdp", + "properties": { + "priority": 1000, + "sourceAddressPrefix": "*", + "protocol": "Tcp", + "destinationPortRange": "3389", + "access": "Allow", + "direction": "Inbound", + "sourcePortRange": "*", + "destinationAddressPrefix": "*" + } + } + ] + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "name": "[concat(parameters('vmNamePrefix'), copyindex())]", + "apiVersion": "[variables('computeAPIVersion')]", + "copy": { + "name": "virtualMachineLoop", + "count": "[variables('numberOfInstances')]" + }, + "location": "[resourceGroup().location]", + "dependsOn": [ + "nicLoop" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": { + "computerName": "[concat(parameters('vmNamePrefix'), copyIndex())]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[parameters('imagePublisher')]", + "offer": "[parameters('imageOffer')]", + "sku": "[parameters('imageSKU')]", + "version": "latest" + }, + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Standard_LRS" + } + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('nicNamePrefix'),copyindex()))]" + } + ] + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(parameters('vmNamePrefix'), copyindex(), '/customScriptExtension')]", + "apiVersion": "2018-06-01", + "location": "[resourceGroup().location]", + "copy": { + "name": "cSELoop", + "count": "[variables('numberOfInstances')]" + }, + "dependsOn": [ + "[concat(parameters('vmNamePrefix'), copyindex())]" + ], + "properties": { + "publisher": "Microsoft.Compute", + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.10", + "autoUpgradeMinorVersion": true, + "Settings": { + "commandToExecute": "powershell.exe Set-ExecutionPolicy Bypass -Scope Process -Force && powershell.exe Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) && powershell.exe c:\\programdata\\chocolatey\\choco.exe install microsoft-edge -y" + } + } + } + ] +} \ No newline at end of file diff --git a/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-parameters.json b/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-parameters.json new file mode 100644 index 00000000..fbc392be --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-parameters.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "value": "Student" + }, + "vmNamePrefix": { + "value": "az104-11-vm" + }, + "nicNamePrefix": { + "value": "az104-11-nic" + }, + "imagePublisher": { + "value": "MicrosoftWindowsServer" + }, + "imageOffer": { + "value": "WindowsServer" + }, + "imageSKU": { + "value": "2019-Datacenter" + }, + "vmSize": { + "value": "Standard_D2s_v3" + }, + "virtualNetworkName": { + "value": "az104-11-vnet" + }, + "addressPrefix": { + "value": "10.0.0.0/24" + }, + "virtualNetworkResourceGroup": { + "value": "az104-11-rg0" + }, + "subnet0Name": { + "value": "subnet0" + }, + "subnet0Prefix": { + "value": "10.0.0.0/26" + } + } +} diff --git a/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-template.json b/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-template.json new file mode 100644 index 00000000..24c2b506 --- /dev/null +++ b/Allfiles/Interactive Lab Simulation Files/11/az104-11-vm-template.json @@ -0,0 +1,279 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "type": "string", + "metadata": { + "description": "Admin username" + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Admin password" + } + }, + "vmNamePrefix": { + "type": "string", + "defaultValue": "az104-11-vm", + "metadata": { + "description": "VM name prefix" + } + }, + "pipNamePrefix": { + "type": "string", + "defaultValue": "az104-11-pip", + "metadata": { + "description": "Public IP address name prefix" + } + }, + "nicNamePrefix": { + "type": "string", + "defaultValue": "az104-11-nic", + "metadata": { + "description": "Nic name prefix" + } + }, + "imagePublisher": { + "type": "string", + "defaultValue": "MicrosoftWindowsServer", + "metadata": { + "description": "Image Publisher" + } + }, + "imageOffer": { + "type": "string", + "defaultValue": "WindowsServer", + "metadata": { + "description": "Image Offer" + } + }, + "imageSKU": { + "type": "string", + "defaultValue": "2019-Datacenter", + "allowedValues": [ + "2019-Datacenter", + "2019-Datacenter-Server-Core", + "2019-Datacenter-Server-Core-smalldisk" + ], + "metadata": { + "description": "Image SKU" + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_D2s_v3", + "metadata": { + "description": "VM size" + } + }, + "virtualNetworkName": { + "type": "string", + "defaultValue": "az104-11-vnet", + "metadata": { + "description": "Virtual network name" + } + }, + "addressPrefix": { + "type": "string", + "defaultValue": "10.0.0.0/24", + "metadata": { + "description": "Virtual network address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "defaultValue": "az104-11-rg0", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "subnet0Name": { + "type": "string", + "defaultValue": "subnet0", + "metadata": { + "description": "VNet first subnet name" + } + }, + "subnet0Prefix": { + "type": "string", + "defaultValue": "10.0.0.0/26", + "metadata": { + "description": "VNet first subnet prefix" + } + }, + "nsgName": { + "type": "string", + "defaultValue": "az104-11-nsg01", + "metadata": { + "description": "Network security group name" + } + } + }, + "variables": { + "vnetID": "[resourceId(parameters('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnet0Name'))]", + "storageAccountName": "[concat('az10411', uniqueString(subscription().subscriptionId))]", + "storageAccountType": "Standard_LRS", + "numberOfInstances": 1, + "computeAPIVersion": "2018-10-01", + "networkAPIVersion": "2018-12-01", + "storageAPIVersion": "2019-04-01" + }, + "resources": [ + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[concat(parameters('nicNamePrefix'), copyindex())]", + "apiVersion": "[variables('networkAPIVersion')]", + "location": "[resourceGroup().location]", + "copy": { + "name": "nicLoop", + "count": "[variables('numberOfInstances')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks/',parameters('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/',parameters('nsgName'))]", + "pipLoop" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[variables('subnetRef')]" + }, + "publicIpAddress": { + "id": "[resourceId('Microsoft.Network/publicIpAddresses',concat(parameters('pipNamePrefix'),copyindex()))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('nsgName'))]" + } + } + }, + { + "type": "Microsoft.Network/virtualNetworks", + "name": "[parameters('virtualNetworkName')]", + "apiVersion": "[variables('networkAPIVersion')]", + "location": "[resourceGroup().location]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnet0Name')]", + "properties": { + "addressPrefix": "[parameters('subnet0Prefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIpAddresses", + "name": "[concat(parameters('pipNamePrefix'), copyindex())]", + "apiVersion": "[variables('networkApiVersion')]", + "copy": { + "name": "pipLoop", + "count": "[variables('numberOfInstances')]" + }, + "location": "[resourceGroup().location]", + "properties": { + "publicIpAllocationMethod": "Dynamic" + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[parameters('nsgName')]", + "apiVersion": "[variables('networkApiVersion')]", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "default-allow-rdp", + "properties": { + "priority": 1000, + "sourceAddressPrefix": "*", + "protocol": "Tcp", + "destinationPortRange": "3389", + "access": "Allow", + "direction": "Inbound", + "sourcePortRange": "*", + "destinationAddressPrefix": "*" + } + } + ] + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('storageAccountName')]", + "apiVersion": "[variables('storageAPIVersion')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "[variables('storageAccountType')]" + }, + "kind": "Storage", + "properties": {} + }, + { + "type": "Microsoft.Compute/virtualMachines", + "name": "[concat(parameters('vmNamePrefix'), copyindex())]", + "apiVersion": "[variables('computeAPIVersion')]", + "copy": { + "name": "virtualMachineLoop", + "count": "[variables('numberOfInstances')]" + }, + "location": "[resourceGroup().location]", + "dependsOn": [ + "nicLoop", + "[resourceId('Microsoft.Storage/storageAccounts/',variables('storageAccountName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": { + "computerName": "[concat(parameters('vmNamePrefix'), copyIndex())]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[parameters('imagePublisher')]", + "offer": "[parameters('imageOffer')]", + "sku": "[parameters('imageSKU')]", + "version": "latest" + }, + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Standard_LRS" + } + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('nicNamePrefix'),copyindex()))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": "true", + "storageUri": "[concat('https://', variables('storageAccountName'), '.blob.core.windows.net')]" + } + } + } + } + ] +} \ No newline at end of file