-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Windows10 with NVidia Extension example (#1232)
* Adding Windows10 with NVidia Extension example Adding Windows10 with Nvidia GPU Driver Extension example as a condition * added trailing newline added trailing newline
- Loading branch information
Showing
3 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
docs/examples/201/vm-windows10-with-nvidia-gpu-extension-and-condition/main.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,113 @@ | ||
//define parameters | ||
param localAdminName string = 'localadmin' | ||
param localAdminPassword string { | ||
secure: true | ||
} | ||
param vnetName string = 'bicep-demo-vnet' | ||
param vmSku string = 'Standard_NV6' | ||
param vmOS string = '20h2-ent' | ||
param installNVidiaGPUDriver bool = true | ||
param vmName string = 'bicep-demo-vm' | ||
|
||
//define variables | ||
var defaultLocation = resourceGroup().location | ||
var defaultVmNicName = '${vmName}-nic' | ||
var vnetConfig = { | ||
vnetprefix: '10.0.0.0/16' | ||
subnet: { | ||
name: 'bicep-demo-subnet' | ||
subnetPrefix: '10.0.66.0/24' | ||
} | ||
} | ||
var privateIPAllocationMethod = 'Dynamic' | ||
|
||
//Create vnet | ||
resource vnet 'Microsoft.Network/virtualNetworks@2020-05-01' = { | ||
name: vnetName | ||
location: defaultLocation | ||
properties: { | ||
addressSpace: { | ||
addressPrefixes: [ | ||
vnetConfig.vnetprefix | ||
] | ||
} | ||
subnets: [ | ||
{ | ||
name: vnetConfig.subnet.name | ||
properties: { | ||
addressPrefix: vnetConfig.subnet.subnetPrefix | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
//create nic | ||
resource vmNic 'Microsoft.Network/networkInterfaces@2017-06-01' = { | ||
name: defaultVmNicName | ||
location: defaultLocation | ||
properties: { | ||
ipConfigurations: [ | ||
{ | ||
name: 'ipconfig1' | ||
properties: { | ||
subnet: { | ||
id: '${vnet.id}/subnets/${vnetConfig.subnet.name}' | ||
} | ||
privateIPAllocationMethod: privateIPAllocationMethod | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
//create VM | ||
resource vm 'Microsoft.Compute/virtualMachines@2019-07-01' = { | ||
name: vmName | ||
location: defaultLocation | ||
properties: { | ||
osProfile: { | ||
computerName: vmName | ||
adminUsername: localAdminName | ||
adminPassword: localAdminPassword | ||
} | ||
hardwareProfile: { | ||
vmSize: vmSku | ||
} | ||
storageProfile: { | ||
imageReference: { | ||
publisher: 'MicrosoftWindowsDesktop' | ||
offer: 'Windows-10' | ||
sku: vmOS | ||
version: 'latest' | ||
} | ||
osDisk: { | ||
createOption: 'FromImage' | ||
} | ||
} | ||
licenseType: 'Windows_Client' | ||
networkProfile: { | ||
networkInterfaces: [ | ||
{ | ||
properties: { | ||
primary: true | ||
} | ||
id: vmNic.id | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
//add Nvidia drivers using extension in condition is true | ||
resource vmgpu 'Microsoft.Compute/virtualMachines/extensions@2020-06-01' = if (installNVidiaGPUDriver) { | ||
name: '${vm.name}/NvidiaGpuDriverWindows' | ||
location: defaultLocation | ||
properties: { | ||
publisher: 'Microsoft.HpcCompute' | ||
type: 'NvidiaGpuDriverWindows' | ||
typeHandlerVersion: '1.3' | ||
autoUpgradeMinorVersion: true | ||
settings: {} | ||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
docs/examples/201/vm-windows10-with-nvidia-gpu-extension-and-condition/main.json
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,149 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"localAdminName": { | ||
"type": "string", | ||
"defaultValue": "localadmin" | ||
}, | ||
"localAdminPassword": { | ||
"type": "secureString" | ||
}, | ||
"vnetName": { | ||
"type": "string", | ||
"defaultValue": "bicep-demo-vnet" | ||
}, | ||
"vmSku": { | ||
"type": "string", | ||
"defaultValue": "Standard_NV6" | ||
}, | ||
"vmOS": { | ||
"type": "string", | ||
"defaultValue": "20h2-ent" | ||
}, | ||
"installNVidiaGPUDriver": { | ||
"type": "bool", | ||
"defaultValue": true | ||
}, | ||
"vmName": { | ||
"type": "string", | ||
"defaultValue": "bicep-demo-vm" | ||
} | ||
}, | ||
"functions": [], | ||
"variables": { | ||
"defaultLocation": "[resourceGroup().location]", | ||
"defaultVmNicName": "[format('{0}-nic', parameters('vmName'))]", | ||
"vnetConfig": { | ||
"vnetprefix": "10.0.0.0/16", | ||
"subnet": { | ||
"name": "bicep-demo-subnet", | ||
"subnetPrefix": "10.0.66.0/24" | ||
} | ||
}, | ||
"privateIPAllocationMethod": "Dynamic" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Network/virtualNetworks", | ||
"apiVersion": "2020-05-01", | ||
"name": "[parameters('vnetName')]", | ||
"location": "[variables('defaultLocation')]", | ||
"properties": { | ||
"addressSpace": { | ||
"addressPrefixes": [ | ||
"[variables('vnetConfig').vnetprefix]" | ||
] | ||
}, | ||
"subnets": [ | ||
{ | ||
"name": "[variables('vnetConfig').subnet.name]", | ||
"properties": { | ||
"addressPrefix": "[variables('vnetConfig').subnet.subnetPrefix]" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Network/networkInterfaces", | ||
"apiVersion": "2017-06-01", | ||
"name": "[variables('defaultVmNicName')]", | ||
"location": "[variables('defaultLocation')]", | ||
"properties": { | ||
"ipConfigurations": [ | ||
{ | ||
"name": "ipconfig1", | ||
"properties": { | ||
"subnet": { | ||
"id": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName')), variables('vnetConfig').subnet.name)]" | ||
}, | ||
"privateIPAllocationMethod": "[variables('privateIPAllocationMethod')]" | ||
} | ||
} | ||
] | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Compute/virtualMachines", | ||
"apiVersion": "2019-07-01", | ||
"name": "[parameters('vmName')]", | ||
"location": "[variables('defaultLocation')]", | ||
"properties": { | ||
"osProfile": { | ||
"computerName": "[parameters('vmName')]", | ||
"adminUsername": "[parameters('localAdminName')]", | ||
"adminPassword": "[parameters('localAdminPassword')]" | ||
}, | ||
"hardwareProfile": { | ||
"vmSize": "[parameters('vmSku')]" | ||
}, | ||
"storageProfile": { | ||
"imageReference": { | ||
"publisher": "MicrosoftWindowsDesktop", | ||
"offer": "Windows-10", | ||
"sku": "[parameters('vmOS')]", | ||
"version": "latest" | ||
}, | ||
"osDisk": { | ||
"createOption": "FromImage" | ||
} | ||
}, | ||
"licenseType": "Windows_Client", | ||
"networkProfile": { | ||
"networkInterfaces": [ | ||
{ | ||
"properties": { | ||
"primary": true | ||
}, | ||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('defaultVmNicName'))]" | ||
} | ||
] | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Network/networkInterfaces', variables('defaultVmNicName'))]" | ||
] | ||
}, | ||
{ | ||
"condition": "[parameters('installNVidiaGPUDriver')]", | ||
"type": "Microsoft.Compute/virtualMachines/extensions", | ||
"apiVersion": "2020-06-01", | ||
"name": "[format('{0}/NvidiaGpuDriverWindows', parameters('vmName'))]", | ||
"location": "[variables('defaultLocation')]", | ||
"properties": { | ||
"publisher": "Microsoft.HpcCompute", | ||
"type": "NvidiaGpuDriverWindows", | ||
"typeHandlerVersion": "1.3", | ||
"autoUpgradeMinorVersion": true, | ||
"settings": {} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" | ||
] | ||
} | ||
] | ||
} |
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