< Back
Add-AzureRmVmssSecret
Post
NAME Add-AzureRmVmssSecret
SYNOPSIS
Adds a secret to a VMSS.
SYNTAX
Add-AzureRmVmssSecret [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet> [[-SourceVaultId] <String>] [[-VaultCertificate] <VaultCertificate[]>]
[-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Add-AzureRmVmssSecret cmdlet adds a secret to the Virtual Machine Scale Set (VMSS). The secret must be stored in an Azure Key Vault. For more
information relating to Key Vault, see What is Azure Key Vault? (https://azure.microsoft.com/en-us/docum ... lt-whatis/)
(https://azure.microsoft.com/en-us/docum ... lt-whatis/). For more information about the cmdlets, see Azure Key Vault Cmdlets
(https://msdn.microsoft.com/library/azure/dn868052.aspx) (https://msdn.microsoft.com/library/azure/dn868052.aspx) in the Microsoft Developer
Network library or the [Set-AzureKeyVaultSecret](/powershell/module/azurerm.keyvault/set-azurekeyvaultsecret)cmdlet.
PARAMETERS
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SourceVaultId <String>
Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the
key for adding multiple certificates. This means that you can use the same value for the SourceVaultId parameter when you add multiple
certificates from the same Key Vault.
Required? false
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VaultCertificate <VaultCertificate[]>
Specifies the Vault Certificate object that contains the certificate URL and certificate name. You can use the
New-AzureRmVmssVaultCertificateConfig (./New-AzureRmVmssVaultCertificateConfig.md)cmdlet to create this object.
Required? false
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VirtualMachineScaleSet <PSVirtualMachineScaleSet>
Specifies the VMSS object. You can use the New-AzureRmVmssConfig (./New-AzureRmVmssConfig.md)cmdlet to create this object.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
VirtualMachineScaleSet
Parameter 'VirtualMachineScaleSet' accepts value of type 'VirtualMachineScaleSet' from the pipeline
OUTPUTS
None
This cmdlet does not generate any output.
NOTES
Example 1: Add a secret to the VMSS
PS C:\\> $Vault = Get-AzureRmKeyVault -VaultName "ContosoVault"
PS C:\\> $CertConfig = New-AzureRmVmssVaultCertificateConfig -CertificateUrl
"http://keyVaultName.vault.contoso.net/s ... retVersion" -CertificateStore "Certificates"
PS C:\\> $VMSS = New-AzureRmVmssConfig
PS C:\\> Add-AzureRmVmssSecret -VirtualMachineScaleSet $VMSS -SourceVaultId $Vault.ResourceId -VaultCertificate $CertConfig
This example adds a secret to the VMSS. The first command uses the Get-AzureRmKeyVault cmdlet to get a vault secret from the vault named
ContosoVault and stores the result in the variable named $Vault. The second command uses the New-AzureRmVmssVaultCertificateConfig cmdlet to
create a Key Vault certificate configuration using the specified certificate URL from the certificate store named Certificates and stores the
results in the variable named $CertConfig. The third command uses the New-AzureRmVmssConfig cmdlet to create a VMSS configuration object and
stores the result in the variable named $VMSS. The fourth command adds a secret to the VMSS using the vault secret using the key resource ID and
the vault certificate stored in the $Vault and $CertConfig variables.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... vmsssecret
New-AzureRmVmssVaultCertificateConfig
New-AzureRmVmssConfig
SYNOPSIS
Adds a secret to a VMSS.
SYNTAX
Add-AzureRmVmssSecret [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet> [[-SourceVaultId] <String>] [[-VaultCertificate] <VaultCertificate[]>]
[-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Add-AzureRmVmssSecret cmdlet adds a secret to the Virtual Machine Scale Set (VMSS). The secret must be stored in an Azure Key Vault. For more
information relating to Key Vault, see What is Azure Key Vault? (https://azure.microsoft.com/en-us/docum ... lt-whatis/)
(https://azure.microsoft.com/en-us/docum ... lt-whatis/). For more information about the cmdlets, see Azure Key Vault Cmdlets
(https://msdn.microsoft.com/library/azure/dn868052.aspx) (https://msdn.microsoft.com/library/azure/dn868052.aspx) in the Microsoft Developer
Network library or the [Set-AzureKeyVaultSecret](/powershell/module/azurerm.keyvault/set-azurekeyvaultsecret)cmdlet.
PARAMETERS
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SourceVaultId <String>
Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the
key for adding multiple certificates. This means that you can use the same value for the SourceVaultId parameter when you add multiple
certificates from the same Key Vault.
Required? false
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VaultCertificate <VaultCertificate[]>
Specifies the Vault Certificate object that contains the certificate URL and certificate name. You can use the
New-AzureRmVmssVaultCertificateConfig (./New-AzureRmVmssVaultCertificateConfig.md)cmdlet to create this object.
Required? false
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-VirtualMachineScaleSet <PSVirtualMachineScaleSet>
Specifies the VMSS object. You can use the New-AzureRmVmssConfig (./New-AzureRmVmssConfig.md)cmdlet to create this object.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
VirtualMachineScaleSet
Parameter 'VirtualMachineScaleSet' accepts value of type 'VirtualMachineScaleSet' from the pipeline
OUTPUTS
None
This cmdlet does not generate any output.
NOTES
Example 1: Add a secret to the VMSS
PS C:\\> $Vault = Get-AzureRmKeyVault -VaultName "ContosoVault"
PS C:\\> $CertConfig = New-AzureRmVmssVaultCertificateConfig -CertificateUrl
"http://keyVaultName.vault.contoso.net/s ... retVersion" -CertificateStore "Certificates"
PS C:\\> $VMSS = New-AzureRmVmssConfig
PS C:\\> Add-AzureRmVmssSecret -VirtualMachineScaleSet $VMSS -SourceVaultId $Vault.ResourceId -VaultCertificate $CertConfig
This example adds a secret to the VMSS. The first command uses the Get-AzureRmKeyVault cmdlet to get a vault secret from the vault named
ContosoVault and stores the result in the variable named $Vault. The second command uses the New-AzureRmVmssVaultCertificateConfig cmdlet to
create a Key Vault certificate configuration using the specified certificate URL from the certificate store named Certificates and stores the
results in the variable named $CertConfig. The third command uses the New-AzureRmVmssConfig cmdlet to create a VMSS configuration object and
stores the result in the variable named $VMSS. The fourth command adds a secret to the VMSS using the vault secret using the key resource ID and
the vault certificate stored in the $Vault and $CertConfig variables.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... vmsssecret
New-AzureRmVmssVaultCertificateConfig
New-AzureRmVmssConfig