title | description | services | author | ms.topic | ms.service | ms.date | ms.author | ms.devlang | ms.custom |
---|---|---|---|---|---|---|---|---|---|
Quickstart: Create an Azure Dedicated HSM with Azure PowerShell |
Create an Azure Dedicated HSM with Azure PowerShell |
dedicated-hsm |
msmbaldwin |
quickstart |
dedicated-hsm |
02/20/2024 |
mbaldwin |
azurepowershell |
devx-track-azurepowershell, mode-api |
This article describes how you can create an Azure Dedicated HSM using the Az.DedicatedHsm PowerShell module.
- If you don't have an Azure subscription, create a free account before you begin.
[!INCLUDE azure-powershell-requirements-no-header.md]
Important
While the Az.DedicatedHsm PowerShell module is in preview, you must install it separately
using the Install-Module
cmdlet. After this PowerShell module becomes generally available, it
will be part of future Az PowerShell module releases and available by default from within Azure
Cloud Shell.
Install-Module -Name Az.DedicatedHsm
-
If you have multiple Azure subscriptions, choose the appropriate subscription in which the resources should be billed. Select a specific subscription using the Set-AzContext cmdlet.
Set-AzContext -SubscriptionId 00000000-0000-0000-0000-000000000000
Create an Azure resource group using the New-AzResourceGroup cmdlet. A resource group is a logical container in which Azure resources are deployed and managed as a group.
The following example creates a resource group with the specified name and in the specified location.
New-AzResourceGroup -Name myRG -Location westus
To create a dedicated HSM, you use the New-AzDedicatedHsm cmdlet. The following example creates a dedicated HSM in the specified subscription.
$Params = @{
Name = 'MyHSM'
ResourceGroupName = 'myRG'
Location = 'westus'
Sku = 'SafeNet Luna Network HSM A790'
StampId = 'stamp1'
SubnetId = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg/providers/Microsoft.Network/virtualNetworks/myhsm-vnet/subnets/hsmsubnet'
NetworkInterface = @{PrivateIPAddress = '10.2.1.120'}
}
New-AzDedicatedHsm @Params
Name Provisioning State SKU Location
---- ------------------ --- --------
myhsm Succeeded SafeNet Luna Network HSM A790 westus
To retrieve information about an existing dedicated HSM, you use the Get-AzDedicatedHsm cmdlet. The following example gets the specified dedicated HSM.
Get-AzDedicatedHsm -Name MyHSM -ResourceGroupName myRG
Name Provisioning State SKU Location
---- ------------------ --- --------
myhsm Succeeded SafeNet Luna Network HSM A790 westus
To update a dedicated HSM, you use the Update-AzDedicatedHsm cmdlet. The following example updates a dedicated HSM in the specified subscription.
Update-AzDedicatedHsm -Name MyHSM -ResourceGroupName myRG -Tag @{'key1' = '1'; 'key2' = 2; 'key3' = 3}
PS C:\>Update-AzDedicatedHsm -Name hsm-n7wfxi -ResourceGroupName dedicatedhsm-rg-n359cz -Tag @{'key1' = '1';
'key2' = 2; 'key3' = 3}
Name Provisioning State SKU Location
---- ------------------ --- --------
myhsm Succeeded SafeNet Luna Network HSM A790 westus
If the resources created in this article aren't needed, you can delete them by running the following examples.
To remove a dedicated HSM, you use the Remove-AzDedicatedHsm cmdlet. The following example deletes the specified dedicated HSM.
Remove-AzDedicatedHsm -Name hsm-7t2xaf -ResourceGroupName lucas-manual-test
Caution
The following example deletes the specified resource group and all resources contained within it. If resources outside the scope of this article exist in the specified resource group, they will also be deleted.
Remove-AzResourceGroup -Name myRG
Learn more about Azure Dedicated HSM.