Skip to content

Add -AsJob to KeyVault cmdlets #5300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ResourceManager/KeyVault/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
## Current Release
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription
* 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.
* Affected cmdlet is: Remove-AzureRmKeyVault

## Version 4.0.1
* Fixed assembly loading issue that caused some cmdlets to fail when executing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,10 @@ function Test-DeleteVaultByName
function Test-DeleteUnknownVaultFails
{
$vaultName = Get-VaultName
$job = Remove-AzureRmKeyVault -VaultName $vaultName -AsJob
$job | Wait-Job

Assert-Throws { Remove-AzureRmKeyVault -VaultName $vaultName }
Assert-Throws { $job | Receive-Job }
}

#-------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase
HelpMessage = "Remove the previously deleted vault permanently.")]
public SwitchParameter InRemovedState { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

#endregion

public override void ExecuteCmdlet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml
Module Name: AzureRM.KeyVault
ms.assetid: 7A929BA8-02D9-4BBE-AFF3-B8781F8DDAD9
Expand All @@ -16,12 +16,12 @@ Deletes a key vault.
### ByAvailableVault
```
Remove-AzureRmKeyVault [-VaultName] <String> [[-ResourceGroupName] <String>] [[-Location] <String>] [-Force]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ByDeletedVault
```
Remove-AzureRmKeyVault [-VaultName] <String> [-Location] <String> [-Force] [-InRemovedState]
Remove-AzureRmKeyVault [-VaultName] <String> [-Location] <String> [-Force] [-InRemovedState] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

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

## PARAMETERS

### -AsJob
Run cmdlet in the background

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure

Expand All @@ -72,7 +87,7 @@ By default, this cmdlet prompts you to confirm that you want to delete the key v
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Aliases:

Required: False
Position: Named
Expand All @@ -87,7 +102,7 @@ Remove the previously deleted vault permanently.
```yaml
Type: SwitchParameter
Parameter Sets: ByDeletedVault
Aliases:
Aliases:

Required: False
Position: Named
Expand All @@ -102,7 +117,7 @@ The location of the deleted vault.
```yaml
Type: String
Parameter Sets: ByAvailableVault
Aliases:
Aliases:

Required: False
Position: 2
Expand All @@ -114,7 +129,7 @@ Accept wildcard characters: False
```yaml
Type: String
Parameter Sets: ByDeletedVault
Aliases:
Aliases:

Required: True
Position: 2
Expand All @@ -129,7 +144,7 @@ Specifies the name of a resource group.
```yaml
Type: String
Parameter Sets: ByAvailableVault
Aliases:
Aliases:

Required: False
Position: 1
Expand All @@ -144,7 +159,7 @@ Specifies the name of the key vault to remove.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases:

Required: True
Position: 0
Expand Down