-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from JCoreMS/JCore-Brownfield-AppAttachToolsVM
Brownfield New App Attach Tools VM - JCore
- Loading branch information
Showing
8 changed files
with
5,304 additions
and
4 deletions.
There are no files selected for viewing
4,550 changes: 4,550 additions & 0 deletions
4,550
workload/arm/brownfield/deployAppAttachToolsVM.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Deploy Azure VM with MSIX App Attach Tools | ||
This deployment will create a VM from the Microsoft Gallery and configure and install software for use when creating MSIX App attach images. | ||
- MSIX App Attach Store App | ||
- MSIX Manager command line tool | ||
- PSFTooling App | ||
- Disables Plug and Play service (prevents new disk pop-up when mounting VHDs) | ||
- Creates C:\MSIX directory with apps and script to convert MSIX to VHD | ||
- Creates a self-signed certificate and places it within the "Trusted People Store" for signing packages | ||
(Consider a Certificate from a Certificate Authority for Production Use) | ||
|
||
## Pre-requisites | ||
|
||
- Azure Tenant and Subscription | ||
- Resource Group | ||
- VNet and Subnet | ||
|
||
## Deployment | ||
|
||
The easiest method is to configure the deployment via the provided blue buttons as they include the custom UI for configuring the options. However, you can also utilize PowerShell and the Azure CLI. | ||
|
||
### Azure Portal UI | ||
|
||
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#blade/Microsoft_Azure_CreateUIDef/CustomDeploymentBlade/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Favdaccelerator%2Fmain%2Fworkload%2Farm%2Fbrownfield%2FdeployAppAttachToolsVM.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Favdaccelerator%2Fmain%2Fworkload%2Fportal-ui%2Fbrownfield%2FportalUiAppAttachToolsVM.json) [![Deploy to Azure Gov](https://aka.ms/deploytoazuregovbutton)](https://portal.azure.us/#blade/Microsoft_Azure_CreateUIDef/CustomDeploymentBlade/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Favdaccelerator%2Fmain%2Fworkload%2Farm%2Fbrownfield%2FdeployAppAttachToolsVM.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Favdaccelerator%2Fmain%2Fworkload%2Fportal-ui%2Fbrownfield%2FportalUiAppAttachToolsVM.json) | ||
|
||
### PowerShell | ||
|
||
```powershell | ||
New-AzDeployment ` | ||
-Location '<Azure location>' ` | ||
-TemplateFile 'https://raw.githubusercontent.com/Azure/avdaccelerator/main/workload/arm/brownfield/deployAppAttachToolsVM.json' ` | ||
-adminUsername '<Local Admin User Name>' ` | ||
-adminPassUseKv false ` | ||
-adminPassword '<Password for Local Admin Account>' ` | ||
-publicIPAllowed '<true or false (Determines if NIC will have a Public IP Address)>' ` | ||
-OSoffer 'WindowsDesktop' ` | ||
-SubnetName '<Name of Subnet where VM will be attached.>' ` | ||
-vmDiskType '<Standard_LRS, StandardSSD_LRS or Premium_LRS>' ` | ||
-vmName '<Name for VM>' ` | ||
-VNet '<Object value surrounded by {} with comma seperated key pairs for desired VNet name, id, location and subscriptionName>' ` | ||
-Verbose | ||
``` | ||
|
||
### Azure CLI | ||
|
||
```azurecli | ||
az deployment sub create \ | ||
--location '<Azure location>' \ | ||
--template-uri 'https://raw.githubusercontent.com/Azure/avdaccelerator/main/workload/arm/brownfield/deployAppAttachToolsVM.json' \ | ||
--parameters \ | ||
-adminUsername '<Local Admin User Name>' \ | ||
-adminPassUseKv false \ | ||
-adminPassword '<Password for Local Admin Account>' \ | ||
-publicIPAllowed '<true or false (Determines if NIC will have a Public IP Address)>' \ | ||
-OSoffer 'WindowsDesktop' \ | ||
-SubnetName '<Name of Subnet where VM will be attached.>' \ | ||
-vmDiskType '<Standard_LRS, StandardSSD_LRS or Premium_LRS>' \ | ||
-vmName '<Name for VM>' \ | ||
-VNet '<Object value surrounded by {} with comma seperated key pairs for desired VNet name, id, location and subscriptionName>' | ||
``` |
74 changes: 74 additions & 0 deletions
74
workload/bicep/brownfield/appAttachToolsVM/modules/VM.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
param AdminUserName string | ||
@secure() | ||
param AdminPassword string | ||
param Location string | ||
param OSoffer string | ||
param OSVersion string | ||
param PostDeployScriptURI string | ||
param UsePublicIP bool | ||
param VMDiskType string | ||
param VMName string | ||
param VMSize string | ||
param VMSubResId string | ||
|
||
|
||
var IPConfig = UsePublicIP ? { | ||
name: 'ipconfig1' | ||
subnetResourceId: VMSubResId | ||
pipConfiguration: { | ||
publicIpNameSuffix: '-pip-01' | ||
deleteOption: 'Delete' | ||
} | ||
} : { | ||
name: 'ipconfig1' | ||
subnetResourceId: VMSubResId | ||
} | ||
|
||
|
||
module virtualMachine '../../../../../carml/1.3.0/Microsoft.Compute/virtualMachines/deploy.bicep' = { | ||
name: 'c_${VMName}_DeployAndConfig' | ||
params: { | ||
name: VMName | ||
location: Location | ||
adminUsername: AdminUserName | ||
adminPassword: AdminPassword | ||
secureBootEnabled: true | ||
securityType: 'TrustedLaunch' | ||
encryptionAtHost: false | ||
vTpmEnabled: true | ||
imageReference: { | ||
publisher: 'MicrosoftWindowsDesktop' | ||
offer: OSoffer | ||
sku: OSVersion | ||
version: 'latest' | ||
} | ||
nicConfigurations: [ | ||
{ | ||
nicSuffix: '${VMName}-nic-01' | ||
deleteOption: 'Delete' | ||
ipConfigurations: [ IPConfig ] | ||
} | ||
] | ||
osDisk: { | ||
createOption: 'FromImage' | ||
deleteOption: 'Delete' | ||
managedDisk: { | ||
storageAccountType: VMDiskType | ||
} | ||
diskSizeGB: 127 | ||
} | ||
osType: 'Windows' | ||
vmSize: VMSize | ||
extensionCustomScriptConfig: { | ||
enabled: true | ||
fileData: [ | ||
{ | ||
uri: '${PostDeployScriptURI}AppAttachVMConfig.ps1' | ||
} | ||
] | ||
} | ||
extensionCustomScriptProtectedSetting: { | ||
commandToExecute: 'powershell -ExecutionPolicy Unrestricted -File AppAttachVMConfig.ps1 -VMUserName ${AdminUserName} -VMUserPassword ${AdminPassword} -PostDeployScriptURI ${PostDeployScriptURI}' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
@description('Username for the Virtual Machine.') | ||
param adminUsername string = 'vmadmin' | ||
|
||
@description('Keyvault Option for Local Admin Password.') | ||
param adminPassUseKv bool = false | ||
|
||
param adminPassKv object = {} | ||
param adminPassKvSecret string = '' | ||
|
||
@description('Password for the Virtual Machine.') | ||
@minLength(12) | ||
@secure() | ||
param adminPassword string = newGuid() | ||
|
||
@description('Create the VM with a Public IP to access the Virtual Machine?') | ||
param publicIPAllowed bool = false | ||
|
||
@description('The Windows version for the VM.') | ||
param OSoffer string | ||
|
||
@description('The Windows build version for the VM.') | ||
param OSVersion string = 'win11-22h2-ent' | ||
|
||
@description('Size of the virtual machine.') | ||
param vmDiskType string | ||
|
||
@description('Size of the virtual machine.') | ||
param vmSize string = 'Standard_D2s_v5' | ||
|
||
@description('Location for all resources.') | ||
param location string = resourceGroup().location | ||
|
||
@description('Name of the virtual machine. (must be 15 characters or less)') | ||
@maxLength(15) | ||
param vmName string = 'vmAppAttach01' | ||
|
||
@description('Virtual Network to attach MSIX Tools VM to.') | ||
param VNet object = { | ||
name: '' | ||
id: '' | ||
location: '' | ||
subscriptionName: '' | ||
} | ||
|
||
@description('Subnet to use for MSIX VM Tools VM.') | ||
param SubnetName string | ||
|
||
var PostDeployScriptURI = 'https://github.com/Azure/avdaccelerator/blob/main/workload/scripts/appAttachToolsVM/' | ||
var VNetSub = split(VNet.id, '/')[2] | ||
var VNetRG = split(VNet.id, '/')[4] | ||
var VNetName = VNet.name | ||
var KVLocalAdminSubId = adminPassUseKv ? split(adminPassKv.id, '/')[2] : '' | ||
var KVLocalAdminRG = adminPassUseKv ? split(adminPassKv.id, '/')[4] : '' | ||
|
||
resource kvVMPassword 'Microsoft.KeyVault/vaults@2023-02-01' existing = if(adminPassUseKv) { | ||
name: adminPassKv.name | ||
scope: resourceGroup(KVLocalAdminSubId, KVLocalAdminRG) | ||
} | ||
|
||
module vmDeploy './modules/VM.bicep' = { | ||
name: 'linked_${vmName}_Deployment' | ||
params: { | ||
AdminUserName: adminUsername | ||
AdminPassword: adminPassUseKv ? kvVMPassword.getSecret(adminPassKvSecret) : adminPassword | ||
Location: location | ||
OSoffer: OSoffer | ||
OSVersion: OSVersion | ||
PostDeployScriptURI: PostDeployScriptURI | ||
UsePublicIP: publicIPAllowed | ||
VMDiskType: vmDiskType | ||
VMName: vmName | ||
VMSubResId: resourceId(VNetSub, VNetRG, 'Microsoft.VirtualNetwork/virtualNetworks/subnets', VNetName, SubnetName) | ||
VMSize: vmSize | ||
} | ||
} | ||
|
Oops, something went wrong.