Powershell

Creating the required IDs and Keys to import into Hava should only take a couple of minutes. If you run into any trouble, feel free to reach out to us.

Azure Powershell Video Walkthrough

1. Launch Powershell

Open the Azure Portal and launch PowerShell from the top menu bar

2. Create Service Principal

You will need to create a new Service Principal from the command line and a display name. In the below code example, we’ve used HavaServicePrincipal you can edit and choose a name that suits you.

$sp = New-AzADServicePrincipal -DisplayName HavaServicePrincipal

3. Assign Reader Role

Hava only requires read-only access for most functionality. You can assign the read-only permissions to the Service Principal account using the below command.

If you would also like to automatically detect and import your public kubernetes clusters you can also add the Azure Kubernetes Service Cluster User Role.

New-AzRoleAssignment -ObjectId $sp.Id -RoleDefinitionName Reader
# This role is optional, but recommened for displaying AKS container views
New-AzRoleAssignment -ObjectId $sp.Id -RoleDefinitionName "Azure Kubernetes Service Cluster User Role"

4. Create the Password

Once you’ve created the Service Principal and assigned it with a Reader Role, you need to create password credentials to attach to the Service Principal.

The following example $endDate is set to expire in 2024. You can set the value to suit and update at a later date if required.

$startDate = Get-Date
$endDate = Get-Date -Year 2024
$creds = New-AzADSpCredential -StartDate $startDate -EndDate $endDate -ObjectId $sp.Id

5. Obtaining the Credentials

The final step required is to retrieve the necessary credentials to input into Hava.

Subscription ID:

(Get-AzContext).Subscription.Id

Tenant ID:

(Get-AzContext).Tenant.Id

Client ID:

$sp.AppId

Secret Key:

$creds.SecretText

One of the most common reasons we see an import fail due to an authentication error is pasting the credentials in the wrong input field or copied and pasting a trailing (space) when entering the IDs and Secret key. One we are guilty of too :)

6. Import in Hava

Once you've populated the input fields with the correct IDs, you can give the Source a familiar name. By default, Hava will use the Subscription ID, which you can update later under the source tab section.

Now hit the IMPORT button and you should start to see Hava importing and generating your automated Azure diagrams.

Last updated