Skip to content

Commit 6d9db2a

Browse files
authored
Update key-vault-linux.md
1 parent bb679b3 commit 6d9db2a

File tree

1 file changed

+64
-25
lines changed

1 file changed

+64
-25
lines changed

articles/virtual-machines/extensions/key-vault-linux.md

Lines changed: 64 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -376,47 +376,86 @@ The Azure PowerShell can be used to deploy the Key Vault VM extension to an exis
376376
* To deploy the extension on a VM:
377377

378378
### [Version-3.0](#tab/version3)
379-
380-
```powershell
381379

382-
# Build settings
383-
$settings = '{"secretsManagementSettings":
384-
{ "pollingIntervalInS": "' + <pollingInterval> +
385-
'", "certificateStoreName": "' + <certStoreName> +
386-
'", "certificateStoreLocation": "' + <certStoreLoc> +
387-
'", "observedCertificates": ["' + <observedCert1> + '","' + <observedCert2> + '"] } }'
388-
$extName = "KeyVaultForLinux"
389-
$extPublisher = "Microsoft.Azure.KeyVault"
390-
$extType = "KeyVaultForLinux"
380+
The Azure Key Vault VM extension can be deployed with Azure PowerShell. Save Key Vault VM extension settings to a JSON file (settings.json).
381+
382+
The following JSON snippets provide example settings for deploying the Key Vault VM extension with PowerShell.
383+
384+
```json
385+
{
386+
"loggingSettings": {
387+
"logger": "fluentd",
388+
"endpoint": "unix:///var/run/azuremonitoragent/sometenant/default_fluent.socket",
389+
"format": "forward",
390+
"servicename": "akvvm_service"
391+
},
392+
"secretsManagementSettings": {
393+
"pollingIntervalInS": "3600",
394+
"linkOnRenewal": true,
395+
"observedCertificates":
396+
[
397+
{
398+
"url": "https://<examplekv>.vault.azure.net/secrets/mycertificate1",
399+
"certificateStoreLocation": "/var/lib/waagent/Microsoft.Azure.KeyVault.Store",
400+
"acls":
401+
[
402+
{
403+
"user": "app1",
404+
"group": "appGroup1"
405+
},
406+
{
407+
"user": "service1"
408+
}
409+
]
410+
},
411+
{
412+
"url": "https://<examplekv>.vault.azure.net/secrets/mycertificate2",
413+
"certificateStoreLocation": "/var/lib/waagent/Microsoft.Azure.KeyVault.Store",
414+
"acls":
415+
[
416+
{
417+
"user": "app2"
418+
}
419+
]
420+
}
421+
]},
422+
"authenticationSettings": {
423+
"msiEndpoint": "http://169.254.169.254/metadata/identity/oauth2/token",
424+
"msiClientId": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
425+
}
426+
}
427+
```
391428

429+
* To deploy the extension on a virtual machine:
392430

393-
# Start the deployment
394-
Set-AzVmExtension -TypeHandlerVersion "2.0" -EnableAutomaticUpgrade true -ResourceGroupName <ResourceGroupName> -Location <Location> -VMName <VMName> -Name $extName -Publisher $extPublisher -Type $extType -SettingString $settings
431+
```powershell
432+
# Build settings
433+
$settings = (get-content -raw ".\settings.json")
434+
$extName = "KeyVaultForLinux"
435+
$extPublisher = "Microsoft.Azure.KeyVault"
436+
$extType = "KeyVaultForLinux"
437+
438+
# Start the deployment
439+
Set-AzVmExtension -TypeHandlerVersion "3.0" -ResourceGroupName <ResourceGroupName> -Location <Location> -VMName <VMName> -Name $extName -Publisher $extPublisher -Type $extType -SettingString $settings
395440
396441
```
397442

398443
* To deploy the extension on a virtual machine scale set:
399444

400445
```powershell
401-
402446
# Build settings
403-
$settings = '{"secretsManagementSettings":
404-
{ "pollingIntervalInS": "' + <pollingInterval> +
405-
'", "certificateStoreName": "' + <certStoreName> +
406-
'", "certificateStoreLocation": "' + <certStoreLoc> +
407-
'", "observedCertificates": ["' + <observedCert1> + '","' + <observedCert2> + '"] } }'
447+
$settings = (get-content -raw ".\settings.json")
408448
$extName = "KeyVaultForLinux"
409449
$extPublisher = "Microsoft.Azure.KeyVault"
410450
$extType = "KeyVaultForLinux"
411-
412-
# Add Extension to VMSS
451+
452+
# Add extension to Virtual Machine Scale Sets
413453
$vmss = Get-AzVmss -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VmssName>
414-
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name $extName -Publisher $extPublisher -Type $extType -TypeHandlerVersion "2.0" -EnableAutomaticUpgrade true -Setting $settings
415-
454+
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name $extName -Publisher $extPublisher -Type $extType -TypeHandlerVersion "3.0" -Setting $settings
455+
416456
# Start the deployment
417-
Update-AzVmss -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VmssName> -VirtualMachineScaleSet $vmss
457+
Update-AzVmss -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VmssName> -VirtualMachineScaleSet $vmss
418458
```
419-
420459
### [Version-1.0/2.0](#tab/version12)
421460

422461
```powershell

0 commit comments

Comments
 (0)