Set-AzKeyVaultKeyRotationPolicy
Anger nyckelroteringsprincipen för den angivna nyckeln i Key Vault.
Syntax
Set-AzKeyVaultKeyRotationPolicy
[-VaultName] <String>
[-Name] <String>
[-ExpiresIn <String>]
[-KeyRotationLifetimeAction <PSKeyRotationLifetimeAction[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzKeyVaultKeyRotationPolicy
[-VaultName] <String>
[-Name] <String>
-PolicyPath <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzKeyVaultKeyRotationPolicy
[-InputObject] <PSKeyVaultKeyIdentityItem>
[-ExpiresIn <String>]
[-KeyRotationLifetimeAction <PSKeyRotationLifetimeAction[]>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzKeyVaultKeyRotationPolicy
[-InputObject] <PSKeyVaultKeyIdentityItem>
-PolicyPath <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzKeyVaultKeyRotationPolicy
[-KeyRotationPolicy] <PSKeyRotationPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Den här cmdleten kräver nyckeluppdateringsbehörigheten. Den returnerar en nyckelrotationsprincip för den angivna nyckeln.
Exempel
Exempel 1: Anger nyckelroteringsprincip efter JSON-fil
<#
rotation_policy.json
{
"lifetimeActions": [
{
"trigger": {
"timeAfterCreate": "P18M",
"timeBeforeExpiry": null
},
"action": {
"type": "Rotate"
}
},
{
"trigger": {
"timeBeforeExpiry": "P30D"
},
"action": {
"type": "Notify"
}
}
],
"attributes": {
"expiryTime": "P2Y"
}
}
#>
Set-AzKeyVaultKeyRotationPolicy -VaultName test-kv -Name test-key -PolicyPath rotation_policy.json
Id : https://test-kv.vault.azure.net/keys/test-key/rotationpolicy
VaultName : test-kv
KeyName : test-keyAM +00:00
LifetimeActions : {[Action: Notify, TimeAfterCreate: , TimeBeforeExpiry: P30D]}
ExpiresIn : P2Y
CreatedOn : 12/10/2021 3:21:51 AM +00:00
UpdatedOn : 6/9/2022 7:43:27
Dessa kommandon anger rotationsprincipen för nyckeln test-key
efter JSON-fil.
Exempel 2: Anger förfallotid för nyckelrotationsprincipen
Set-AzKeyVaultKeyRotationPolicy -VaultName test-kv -Name test-key -ExpiresIn P2Y
Id : https://test-kv.vault.azure.net/keys/test-key/rotationpolicy
VaultName : test-kv
KeyName : test-keyAM +00:00
LifetimeActions : {[Action: Notify, TimeAfterCreate: , TimeBeforeExpiry: P30D]}
ExpiresIn : P2Y
CreatedOn : 12/10/2021 3:21:51 AM +00:00
UpdatedOn : 6/9/2022 7:43:27
Dessa kommandon anger att förfallotiden ska tillämpas på den nya nyckelversionen på test-key
två år.
Exempel 3: Anger nyckelroteringsprincip via rördragning
Get-AzKeyVaultKey -VaultName test-kv -Name test-key | Set-AzKeyVaultKeyRotationPolicy -KeyRotationLifetimeAction @{Action = "Rotate"; TimeBeforeExpiry = "P18M"}
Id : https://test-kv.vault.azure.net/keys/test-key/rotationpolicy
VaultName : test-kv
KeyName : test-key
LifetimeActions : {[Action: Rotate, TimeAfterCreate: , TimeBeforeExpiry: P18M], [Action: Notify, TimeAfterCreate: ,
TimeBeforeExpiry: P30D]}
ExpiresIn : P2Y
CreatedOn : 12/10/2021 3:21:51 AM +00:00
UpdatedOn : 6/9/2022 8:10:43 AM +00:00
Dessa kommandon anger varaktigheten före förfallodatum för att försöka rotera test-key
som 18 månader.
Exempel 4: Kopiera nyckelroteringsprincip till en annan nyckel via PSKeyRotationPolicy-objekt
$policy = Get-AzKeyVaultKeyRotationPolicy -VaultName test-kv -Name test-key1
$policy.KeyName = "test-key2"
$policy | Set-AzKeyVaultKeyRotationPolicy
Id : https://test-kv.vault.azure.net/keys/test-key2/rotationpolicy
VaultName : test-kv
KeyName : test-key2
LifetimeActions : {[Action: Rotate, TimeAfterCreate: , TimeBeforeExpiry: P18M], [Action: Notify, TimeAfterCreate: ,
TimeBeforeExpiry: P30D]}
ExpiresIn : P2Y
CreatedOn : 6/9/2022 8:26:35 AM +00:00
UpdatedOn : 6/9/2022 8:26:35 AM +00:00
Dessa kommandon kopierar nyckelroteringsprincipen test-key1
till nyckeln test-key2
.
Parametrar
-Confirm
Uppmanar dig att bekräfta innan du kör cmdleten.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ExpiresIn
ExpiryTime tillämpas på den nya nyckelversionen. Det bör vara minst 28 dagar. Den kommer att vara i ISO 8601-format. Exempel: 90 dagar: P90D, 3 månader: P3M, 48 timmar: PT48H, 1 år och 10 dagar: P1Y10D.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Nyckelobjekt
Type: | PSKeyVaultKeyIdentityItem |
Aliases: | Key |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-KeyRotationLifetimeAction
PSKeyRotationLifetimeAction-objekt.
Type: | PSKeyRotationLifetimeAction[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-KeyRotationPolicy
PSKeyRotationPolicy-objekt.
Type: | PSKeyRotationPolicy |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Nyckelnamn.
Type: | String |
Aliases: | KeyName |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PolicyPath
En sökväg till roteringsprincipfilen som innehåller JSON-principdefinitionen.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VaultName
Valvnamn.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Visar vad som skulle hända om cmdleten kördes. Cmdleten körs inte.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indata
Utdata
Relaterade länkar
Azure PowerShell
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: Under hela 2024 kommer vi att fasa ut GitHub-problem som feedbackmekanism för innehåll och ersätta det med ett nytt feedbacksystem. Mer information finns i:Skicka och visa feedback för