Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Add-AzureVMSecret

Add-AzureVMSecret

microsoft.azure.commands.compute.dll

Synopsis

Add a secret to the VM which allows you to place a certificate on the VM

Syntax

Add-AzureVMSecret [-VM] [-SourceVaultId] [-CertificateStore] [-CertificateUrl] [-Profile] [-InformationAction] [-InformationVariable] [<CommonParameters>]

Detailed Description

Add a secret to the VM which allows you to place a certificate on the VM

Parameters

-VM <PSVirtualMachine>

VM object to modify. Create one using New-AzureVMConfig cmdlet or Get one using the Get-AzureVM cmdlet.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-SourceVaultId <String>

Resource Id of the Key Vault which contains the certificates to place on the VM. Also acts as the key for adding multiple certificates i.e. use the same SourceVaultId when adding multiple certificates from the same KeyVault

Aliases

None

Required?

false

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-CertificateStore <String>

Name of the certificate store on the Windows VM the certificate should be added to

Aliases

None

Required?

false

Position

2

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-CertificateUrl <String>

A KeyVault Url pointing to a KeyVault secret which contains a certificate formatted as follows

It is the Base64 encoding of the following JSON Object which is encoded in UTF-8

{ “data”:”<Base64-encoded-file>”, “dataType” :”<file-format>”, “password”:”<pfx-file-password>” }

Aliases

None

Required?

false

Position

3

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Profile <AzureProfile>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationAction <ActionPreference>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationVariable <String>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- Example 1 --------------------------

$vm = New-AzureVMConfig -VMName $vmname -VMSize $vmsize;

$vm = Set-AzureVMOperatingSystem -VM $vm -Windows -ComputerName $computerName -Credential $cred

$SourceVaultId = "/subscriptions/" + $subid + "/resourceGroups/RgTest1/providers/Microsoft.KeyVault/vaults/TestVault123";
$certStore = "My";
$certUrl =  "https://testvault123.vault.azure.net/secrets/Test1/514ceb769c984379a7e0230bdd703272";
$vm = Add-AzureVMSecret -VM $vm -SourceVaultId $SourceVaultId -CertificateStore $certStore -CertificateUrl $certUrl;

$SourceVaultId2 = "/subscriptions/" + $subid + "/resourceGroups/RgTest1/providers/Microsoft.KeyVault/vaults/TestVault456";
$vm = Add-AzureVMSecret -VM $vm -SourceVaultId $SourceVaultId2 -CertificateStore $certStore -CertificateUrl $certUrl;

$certStore2 = "My2";
$certUrl2 =  "https://testvault123.vault.azure.net/secrets/Test1/514ceb769c984379a7e0230bddaaaaaa";
$vm = Add-AzureVMSecret -VM $vm -SourceVaultId $SourceVaultId -CertificateStore $certStore2 -CertificateUrl $certUrl2;