I deleted an HSM key vault, but I’m so far unable to purge that through PowerShell, please help!

Mike 61 Reputation points
2023-08-14T21:11:28.2633333+00:00

Hi,

I could really use assistance with purging an “HSM key vault” that I added to my Azure portal last week. I created the “HSM key vault” as part of an online video lesson I was going through, in preparation for the AZ-104 exam. However, I’ve been attempting to delete that “HSM key vault” ever since, as it has been increasing my Azure bill on a daily basis.

 

As of now I located this Learn.Microsoft forum post regarding this very situation! https://learn.microsoft.com/en-us/answers/questions/1343873/i-deleted-an-hsm-in-keyvault-but-im-still-paying-f

From that I was able to use Powershell to delete the HSM key vault, however when I put in the command to purge the HSM key vault. I receive this message

 

Cmdlet Remove-AzKeyVaultManagedHsm at command pipeline position 1

Supply values for the following parameters:

(Type !? for Help.)

InRemovedState:

 

With that above message, I attempted going through the information indicated in the linked post above, but I did not see any specific command to put in for the “InRemovedState” message. I also attempted typing in the !? for help information.

 

It then returned this message:

Remove the previously deleted managed HSM pool permanently.

 

I then typed:

Yes

 

It then returned the message:

Remove-AzKeyVaultManagedHsm: Cannot convert ‘System.String’ to the type ‘System.Management.Automation.SwitchParameter’ required by parameter ‘InRemovedState’.

 

So as of now I could really use advise as what the PowerShell command is, to purge the “HSM key vault”. So that I can stop the charge on my bill from increasing any further. As well as so that I know what to do in case I come across this situation again.

Please advise!!

Azure Dedicated HSM
Azure Dedicated HSM
An Azure service that provides hardware security module management.
27 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,521 Reputation points Microsoft Employee
    2023-08-15T19:47:13.9766667+00:00

    @Mike

    Thank you for your post!

    Error Message:
    Cmdlet Remove-AzKeyVaultManagedHsm at command pipeline position 1

    Supply values for the following parameters: (Type !? for Help.)

    InRemovedState:

    I understand that you're trying to purge your Managed HSM using PowerShell and even when using the PowerShell command referenced in a related Q&A question, you're running into issues preventing you from purging your HSM. To hopefully help point you in the right direction or resolve your issue, I'll share my findings below.


    Findings:

    Based off your error message, it looks like you'll need to use the -InRemovedState parameter within your initial Remove-AzKeyVaultManagedHsm cmdlet.

    Remove-AzKeyVaultManagedHsm -Name 'myhsm' -Location "eastus" -Force -PassThru -InRemovedState
    

    To purge a soft-deleted HSM:

    az keyvault purge --subscription {SUBSCRIPTION ID} --hsm-name {HSM NAME} --location {LOCATION}
    

    User's image


    If you're still having issues and would like to work directly with our support team to get this issue resolved, can you please email me with the info below. I'll enable a one-time free technical support request for your subscription so you can get this issue resolved.

    Email: AzCommunity@microsoft.com
    Subject: ATTN - James Tran
    Body:
    Azure Subscription ID
    Link to this issue
    

    I hope this helps!

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful