Skip to main content

Examples

This page contains the base examples for mapping Azure resources to Port.

This base example thrives to provide a simpler and more abstract way to map Azure resources to Port.

The simplification is achieved by using the generic cloudResource kind and blueprint, which can be used to map any Azure resource to Port.

Azure Basic Blueprints

Mapping Azure Subscriptions​

In the following example you will ingest your Azure Subscriptions to Port, you may use the following Port blueprint definitions and integration configuration:

Subscription Blueprint
{
"identifier": "azureSubscription",
"title": "Azure Subscription",
"icon": "Azure",
"schema": {
"properties": {},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Mapping configuration for Azure Subscriptions
resources:
- kind: subscription
selector:
query: 'true'
apiVersion: '2022-09-01'
port:
entity:
mappings:
identifier: .id
title: .display_name
blueprint: '"azureSubscription"'
properties: {}

Here are the API references we used to create those blueprints and app config:

Mapping Resource Groups​

Relate subscriptions and resource groups

The Resource Group has a relation to the Subscription, so the creation of the Subscription blueprint is required.

In the following example you will ingest your Azure Resource Groups to Port, you may use the following Port blueprint definitions and integration configuration:

Resource Group blueprint
{
"identifier": "azureResourceGroup",
"description": "This blueprint represents an Azure Resource Group in our software catalog",
"title": "Resource Group",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string"
},
"tags": {
"title": "Tags",
"type": "object"
}
}
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"subscription": {
"target": "azureSubscription",
"title": "Subscription",
"required": false,
"many": false
}
}
}
Mapping Configuration for Resource group
resources:
- kind: Microsoft.Resources/resourceGroups
selector:
query: 'true'
apiVersion: '2022-09-01'
port:
entity:
mappings:
identifier: >-
.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
join("/")
title: .name
blueprint: '"azureResourceGroup"'
properties:
location: .location
provisioningState: .properties.provisioningState + .properties.provisioning_state
tags: .tags
relations:
subscription: >-
.id | split("/") | .[1] |= ascii_downcase |.[2] |= ascii_downcase
| .[:3] |join("/")

Here are the API references we used to create those blueprints and app config:

Mapping Cloud Resources​

In the following example you will ingest your Azure Resources to Port, you may use the following Port blueprint definitions and integration configuration:

Relate resources and resource groups

The Resources below have a relation to the Resource Group, so the creation of the Resource Group blueprint is required.

Cloud Resource Blueprint
{
"identifier": "azureCloudResource",
"title": "Cloud Resource",
"icon": "Azure",
"schema": {
"properties": {
"type": {
"icon": "Service",
"title": "Type",
"type": "string"
},
"location": {
"icon": "Home",
"title": "Location",
"type": "string"
},
"tags": {
"title": "Tags",
"type": "object",
"icon": "BlankPage"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"resource_group": {
"title": "Resource Group",
"target": "azureResourceGroup",
"required": false,
"many": false
}
}
}

Mapping configuration for cloud resources
Cloud resource kind

The cloudResource kind is a generic kind that can be used to map most cloud resources.

The mapping requires passing the resource kind and version as a parameter inside the resourceKinds object.

It is possible that some of the kinds that you want to export are not in this example, head to the bottom of the page to see how to add them.

resources:
- kind: cloudResource
selector:
query: 'true'
resourceKinds:
Microsoft.App/containerApps: '2022-03-01'
Microsoft.Storage/storageAccounts: '2023-01-01'
Microsoft.Compute/virtualMachines: '2023-03-01'
Microsoft.ContainerService/managedClusters: '2023-05-01'
Microsoft.Network/loadBalancers: '2023-02-01'
port:
entity:
mappings:
identifier: >-
.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
join("/")
title: .name
blueprint: '"azureCloudResource"'
properties:
location: .location
type: .type
tags: .tags
relations:
resource_group: >-
.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase
| .[:5] |join("/")

Here are the API references we used to create those blueprints and app config:

Mapping Extra Resources​

The resources in this page are only a few of the resources that the Azure Exporter supports.

If the resources you want to ingest into Port do not appear in these examples, you can head to the Mapping Extra Resources page to learn about all of the kinds of Azure resources that are supported by the Azure integration and how to map them into Port.

Advanced Use Cases​

In certain scenarios you may want to model your Azure resources in a more detailed way.

For example, you may want to model a Storage Account and its Containers separately.

For these cases, head to the Advanced Examples page to learn how to model your Azure resources in a more detailed way.