Get-AzKeyVaultRandomNumber
Get the requested number of bytes containing random values from a managed HSM.
Syntax
Get-AzKeyVaultRandomNumber
[-DefaultProfile <IAzureContextContainer>]
[-HsmName] <String>
-Count <Int32>
[-AsBase64String]
[<CommonParameters>]
Get-AzKeyVaultRandomNumber
[-ResourceId] <String>
[-DefaultProfile <IAzureContextContainer>]
-Count <Int32>
[-AsBase64String]
[<CommonParameters>]
Get-AzKeyVaultRandomNumber
[-DefaultProfile <IAzureContextContainer>]
[-InputObject] <PSManagedHsm>
-Count <Int32>
[-AsBase64String]
[<CommonParameters>]
Description
Get the requested number of bytes containing random values from a managed HSM.
Examples
Example 1: Get requested number of random bytes by managed HSM name
Get-AzKeyVaultRandomNumber -HsmName testmhsm -Count 10
158
171
96
142
109
28
1
85
178
201
This command gets 10 random bytes from managed HSM "testmhsm"
Example 2: Get random number as base64 string by piping
Get-AzKeyVaultManagedHsm -HsmName bezmhsm2022 | Get-AzKeyVaultRandomNumber -Count 10 -AsBase64String
G1CsEqa9yUp/EA==
This command gets 10 random bytes as base-64 string from managed HSM "testmhsm"
Example 3: Get random number by resource id
Get-AzKeyVaultRandomNumber -ResourceId /subscriptions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/test-rg/provders/Microsoft.KeyVault/managedHSMs/testhsm -Count 10
158
171
96
142
109
28
1
85
178
201
This command gets 10 random bytes from managed HSM with specified resource id
Parameters
-AsBase64String
If specified, return random number as base-64 digit. By default, this command retruns random number as byte array.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Count
The requested number of random bytes.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-HsmName
HSM name. Cmdlet constructs the FQDN of a managed HSM based on the name and currently selected environment.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
HSM object.
Type: | PSManagedHsm |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceId
HSM resource id.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |