Get-AzKeyVaultRandomNumber
Get the requested number of bytes containing random values from a managed HSM.
Syntax
GetByHsmName (Default)
Get-AzKeyVaultRandomNumber
[-HsmName] <String>
-Count <Int32>
[-DefaultProfile <IAzureContextContainer>]
[-AsBase64String]
[<CommonParameters>]
GetByHsmResourceId
Get-AzKeyVaultRandomNumber
[-ResourceId] <String>
-Count <Int32>
[-DefaultProfile <IAzureContextContainer>]
[-AsBase64String]
[<CommonParameters>]
GetByHsmInputObject
Get-AzKeyVaultRandomNumber
[-InputObject] <PSManagedHsm>
-Count <Int32>
[-DefaultProfile <IAzureContextContainer>]
[-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/0b1fxxxx-xxxx-xxxx-aec3-xxxx72f09590/resourceGroups/test-rg/providers/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.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Count
The requested number of random bytes.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-HsmName
HSM name. Cmdlet constructs the FQDN of a managed HSM based on the name and currently selected environment.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetByHsmName
Position: | 0 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-InputObject
HSM object.
Parameter properties
Type: | PSManagedHsm |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetByHsmInputObject
Position: | 0 |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ResourceId
HSM resource id.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
GetByHsmResourceId
Position: | 0 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.