-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Key Vault virtual machine extension examples and suggestions #15467
Changes from all commits
b52ca85
daf8bf3
a878f38
69ce56b
6af2fd6
5dd4a34
46ba474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,32 @@ For more information about the cmdlets, see [Azure Key Vault Cmdlets](/powershel | |
|
||
## EXAMPLES | ||
|
||
### Example 1: Add a secret to the VMSS | ||
### Example 1: Add a secret to the VMSS using the Azure Key Vault virtual machine extension | ||
|
||
```powershell | ||
# Build settings | ||
PS C:\> $settings = @{ | ||
secretsManagementSettings = @{ | ||
pollingIntervalInS = "<pollingInterval>" | ||
certificateStoreName = "<certStoreName>" | ||
certificateStoreLocation = "<certStoreLoc>" | ||
observedCertificates = @("<observedCert1>", "<observedCert2>") | ||
} | ||
} | ConvertTo-Json | ||
PS C:\> $extName = "KeyVaultForLinux" | ||
PS C:\> $extPublisher = "Microsoft.Azure.KeyVault" | ||
PS C:\> $extType = "KeyVaultForLinux" | ||
# Add Extension to VMSS | ||
PS C:\> $vmss = Get-AzVmss -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VmssName> | ||
PS C:\> Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name $extName -Publisher $extPublisher -Type $extType -TypeHandlerVersion "2.0" -Setting $settings | ||
# Start the deployment | ||
PS C:\> Update-AzVmss -ResourceGroupName <ResourceGroupName> -VMScaleSetName <VmssName> -VirtualMachineScaleSet $vmss | ||
``` | ||
|
||
To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the above statement be added before the Example 1 that provides the steps to add a secret to the VMSS using the Azure Key Vault extension, also we should mention virtual machine scaleset vm or someting similar that points to the scaleset resource which is different than the stand alone vm resource. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I basically just inserted the extension info into what was already there. I will revisit this and see how to make the order more clear. |
||
|
||
### Example 2: Add a secret to the VMSS using Add-AzVmssSecret | ||
```powershell | ||
PS C:\> $Vault = Get-AzKeyVault -VaultName "ContosoVault" | ||
PS C:\> $CertConfig = New-AzVmssVaultCertificateConfig -CertificateUrl "http://keyVaultName.vault.contoso.net/secrets/secretName/secretVersion" -CertificateStore "Certificates" | ||
PS C:\> $VMSS = New-AzVmssConfig | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in virtual word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will push and update.