Skip to content

Commit 934becc

Browse files
author
maddieclayton
authored
Merge pull request #5300 from maddieclayton/keyvaultasjob
Add -AsJob to KeyVault cmdlets
2 parents 5821259 + b82e227 commit 934becc

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

src/ResourceManager/KeyVault/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
## Current Release
2121
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
2222
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription
23+
* Added -AsJob support for long-running KeyVault cmdlets. Allows selected cmdlets to run in the background and return a job to track and control progress.
24+
* Affected cmdlet is: Remove-AzureRmKeyVault
2325

2426
## Version 4.0.1
2527
* Fixed assembly loading issue that caused some cmdlets to fail when executing

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Scripts/ControlPlane/KeyVaultManagementTests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,10 @@ function Test-DeleteVaultByName
414414
function Test-DeleteUnknownVaultFails
415415
{
416416
$vaultName = Get-VaultName
417+
$job = Remove-AzureRmKeyVault -VaultName $vaultName -AsJob
418+
$job | Wait-Job
417419

418-
Assert-Throws { Remove-AzureRmKeyVault -VaultName $vaultName }
420+
Assert-Throws { $job | Receive-Job }
419421
}
420422

421423
#-------------------------------------------------------------------------------------

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase
8686
HelpMessage = "Remove the previously deleted vault permanently.")]
8787
public SwitchParameter InRemovedState { get; set; }
8888

89+
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
90+
public SwitchParameter AsJob { get; set; }
91+
8992
#endregion
9093

9194
public override void ExecuteCmdlet()

src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml
33
Module Name: AzureRM.KeyVault
44
ms.assetid: 7A929BA8-02D9-4BBE-AFF3-B8781F8DDAD9
@@ -16,12 +16,12 @@ Deletes a key vault.
1616
### ByAvailableVault
1717
```
1818
Remove-AzureRmKeyVault [-VaultName] <String> [[-ResourceGroupName] <String>] [[-Location] <String>] [-Force]
19-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
19+
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2020
```
2121

2222
### ByDeletedVault
2323
```
24-
Remove-AzureRmKeyVault [-VaultName] <String> [-Location] <String> [-Force] [-InRemovedState]
24+
Remove-AzureRmKeyVault [-VaultName] <String> [-Location] <String> [-Force] [-InRemovedState] [-AsJob]
2525
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2626
```
2727

@@ -50,6 +50,21 @@ If you do not specify the resource group name, the cmdlet searches for the named
5050

5151
## PARAMETERS
5252

53+
### -AsJob
54+
Run cmdlet in the background
55+
56+
```yaml
57+
Type: SwitchParameter
58+
Parameter Sets: (All)
59+
Aliases:
60+
61+
Required: False
62+
Position: Named
63+
Default value: None
64+
Accept pipeline input: False
65+
Accept wildcard characters: False
66+
```
67+
5368
### -DefaultProfile
5469
The credentials, account, tenant, and subscription used for communication with azure
5570
@@ -72,7 +87,7 @@ By default, this cmdlet prompts you to confirm that you want to delete the key v
7287
```yaml
7388
Type: SwitchParameter
7489
Parameter Sets: (All)
75-
Aliases:
90+
Aliases:
7691

7792
Required: False
7893
Position: Named
@@ -87,7 +102,7 @@ Remove the previously deleted vault permanently.
87102
```yaml
88103
Type: SwitchParameter
89104
Parameter Sets: ByDeletedVault
90-
Aliases:
105+
Aliases:
91106

92107
Required: False
93108
Position: Named
@@ -102,7 +117,7 @@ The location of the deleted vault.
102117
```yaml
103118
Type: String
104119
Parameter Sets: ByAvailableVault
105-
Aliases:
120+
Aliases:
106121

107122
Required: False
108123
Position: 2
@@ -114,7 +129,7 @@ Accept wildcard characters: False
114129
```yaml
115130
Type: String
116131
Parameter Sets: ByDeletedVault
117-
Aliases:
132+
Aliases:
118133

119134
Required: True
120135
Position: 2
@@ -129,7 +144,7 @@ Specifies the name of a resource group.
129144
```yaml
130145
Type: String
131146
Parameter Sets: ByAvailableVault
132-
Aliases:
147+
Aliases:
133148

134149
Required: False
135150
Position: 1
@@ -144,7 +159,7 @@ Specifies the name of the key vault to remove.
144159
```yaml
145160
Type: String
146161
Parameter Sets: (All)
147-
Aliases:
162+
Aliases:
148163

149164
Required: True
150165
Position: 0

0 commit comments

Comments
 (0)