Skip to main content

示例

本页面中的资源只是 Azure 输出程序支持的少数资源。 如果没有找到要映射到 Port 的 Azure 资源,请访问Mapping Extra Resources 页面,了解 Azure 集成支持哪些 Azure 资源以及如何将它们映射到 Port。

映射资源组

在以下示例中,您将把 Azure 资源组引用到 Port,您可以使用以下 Port 蓝图定义和集成配置:

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"
}
}
}
}
Mapping Configuration for Resource group
resources:
- kind: Microsoft.Resources/resourceGroups
selector:
query: "true"
apiVersion: "2022-09-01" # azure resource api version to query
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureResourceGroup"'
properties:
location: .location
# the provisioning state property is returned in lower case when using the SDK and in camelCase when using the REST API
# therefore supporting both (for users who use the SDK)
provisioningState: .properties.provisioningState + .properties.provisioning_state
tags: .tags

以下是我们用来创建这些蓝图和应用程序配置的 API 引用:

映射存储资源

在下面的示例中,您将把 Azure 存储账户和容器引用到 Port,您可以使用下面的 Port 蓝图定义和集成配置:

存储账户与资源组有关系,因此需要创建Resource Group blueprint
Storage Account Blueprint
{
"identifier": "azureStorageAccount",
"description": "This blueprint represents an Azure Storage Account in our software catalog",
"title": "Storage Account",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string",
"enum": ["Creating", "ResolvingDNS", "Succeeded"]
},
"creationTime": {
"title": "Creation Time",
"type": "string",
"format": "date-time"
},
"isHnsEnabled": {
"title": "Is HNS Enabled",
"type": "boolean",
"default": false
},
"fileEncryptionEnabled": {
"title": "File Encryption Enabled",
"type": "boolean"
},
"blobEncryptionEnabled": {
"title": "Blob Encryption Enabled",
"type": "boolean"
},
"primaryLocation": {
"title": "Primary Location",
"type": "string"
},
"secondaryLocation": {
"title": "Secondary Location",
"type": "string"
},
"statusOfPrimary": {
"title": "Status of Primary",
"type": "string",
"enum": ["available", "unavailable"],
"enumColors": {
"unavailable": "red",
"available": "green"
}
},
"statusOfSecondary": {
"title": "Status of Secondary",
"type": "string",
"enum": ["available", "unavailable"],
"enumColors": {
"unavailable": "red",
"available": "green"
}
},
"tags": {
"title": "Tags",
"type": "object"
},
"allowBlobPublicAccess": {
"title": "Allow Blob Public Access",
"type": "boolean"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}
Storage Container Blueprint
{
"identifier": "azureStorageContainer",
"description": "This blueprint represents an Azure Storage Container in our software catalog",
"title": "Storage Container",
"icon": "Azure",
"schema": {
"properties": {
"publicAccess": {
"title": "Public Access",
"type": "string"
},
"hasImmutabilityPolicy": {
"title": "Has Immutability Policy",
"type": "boolean"
},
"hasLegalHold": {
"title": "Has Legal Hold",
"type": "boolean"
},
"deleted": {
"title": "Deleted",
"type": "boolean"
},
"deletedTime": {
"title": "Deleted Time",
"type": "string"
},
"remainingRetentionDays": {
"title": "Remaining Retention Days",
"type": "number"
},
"leaseStatus": {
"title": "Lease Status",
"type": "string"
},
"leaseState": {
"title": "Lease State",
"type": "string"
},
"defaultEncryptionScope": {
"title": "Default Encryption Scope",
"type": "string"
},
"version": {
"title": "Version",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"storageAccount": {
"target": "azureStorageAccount",
"title": "Storage Account",
"required": false,
"many": false
}
}
}

Mapping configuration for Storage Account and Storage Container

resources:
- kind: Microsoft.Storage/storageAccounts
selector:
query: "true"
# azure resource api version to query
apiVersion: "2023-01-01"
port:
entity:
mappings:
# lowercase only the resourceGroups namespace and name to align how azure API returns the resource group reference
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureStorageAccount"'
properties:
location: .location
provisioningState: .properties.provisioningState
creationTime: .properties.creationTime
isHnsEnabled: .properties.isHnsEnabled
fileEncryptionEnabled: .properties.encryption.services.file.enabled
blobEncryptionEnabled: .properties.encryption.services.blob.enabled
primaryLocation: .properties.primaryLocation
secondaryLocation: .properties.secondaryLocation
statusOfPrimary: .properties.statusOfPrimary
statusOfSecondary: .properties.statusOfSecondary
allowBlobPublicAccess: .properties.allowBlobPublicAccess
tags: .tags
relations:
# resolve resource group id from storage account id
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'

- kind: Microsoft.Storage/storageAccounts/blobServices/containers
selector:
query: "true"
# azure resource api version to query
apiVersion: "2023-01-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureStorageContainer"'
properties:
publicAccess: .properties.publicAccess
hasImmutabilityPolicy: .properties.hasImmutabilityPolicy
hasLegalHold: .properties.hasLegalHold
deleted: .properties.deleted
deletedTime: .properties.deletedTime
remainingRetentionDays: .properties.remainingRetentionDays
leaseStatus: .properties.leaseStatus
leaseState: .properties.leaseState
defaultEncryptionScope: .properties.defaultEncryptionScope
version: .properties.version
relations:
# resolve storage account id from container id
storageAccount: '.id | split("/") | .[3] |= ascii_downcase | .[4] |= ascii_downcase | .[:-4] | join("/")'

以下是我们用来创建这些蓝图和应用程序配置的 API 引用:

映射计算资源

在以下示例中,您将把 Azure 资源引用到 Port,您可以使用以下 Port 蓝图定义和集成配置:

下面的资源与资源组有关系,因此需要创建Resource Group blueprint
ASK blueprint
{
"identifier": "azureAks",
"description": "This blueprint represents an Azure Kubernetes Service in our software catalog",
"title": "AKS",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string"
},
"powerState": {
"title": "Power State",
"type": "string"
},
"kubernetesVersion": {
"title": "Kubernetes Version",
"type": "string"
},
"currentKubernetesVersion": {
"title": "Current Kubernetes Version",
"type": "string"
},
"dnsPrefix": {
"title": "DNS Prefix",
"type": "string"
},
"fqdn": {
"title": "FQDN",
"type": "string"
},
"nodeResourceGroup": {
"title": "Node Resource Group",
"type": "string"
},
"enableRBAC": {
"title": "Enable RBAC",
"type": "boolean"
},
"supportPlan": {
"title": "Support Plan",
"type": "string"
},
"networkPlugin": {
"title": "Network Plugin",
"type": "string"
},
"podCIDR": {
"title": "Pod CIDR",
"type": "string"
},
"serviceCIDR": {
"title": "Service CIDR",
"type": "string"
},
"dnsServiceIp": {
"title": "DNS Service IP",
"type": "string"
},
"outboundType": {
"title": "Outbound Type",
"type": "string"
},
"loadBalancerSKU": {
"title": "Load Balancer SKU",
"type": "string"
},
"maxAgentPools": {
"title": "Max Agent Pools",
"type": "number"
},
"skuTier": {
"title": "Tier",
"type": "string",
"enum": ["Free", "Paid", "Standard"]
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}
Container App blueprint
{
"identifier": "azureContainerApp",
"description": "This blueprint represents an Azure Container App in our software catalog",
"title": "Container App",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string",
"enum": ["Canceled", "InProgress", "Succeeded", "Deleting", "Failed"]
},
"outboundIpAddresses": {
"title": "Outbound IP Addresses",
"type": "array"
},
"externalIngress": {
"title": "External Ingress",
"type": "boolean"
},
"hostName": {
"title": "Host Name",
"type": "string"
},
"minReplicas": {
"title": "Min Replicas",
"type": "number"
},
"maxReplicas": {
"title": "Max Replicas",
"type": "number"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}
Load Balancer blueprint
  {
"identifier": "azureLoadBalancer",
"description": "This blueprint represents an Azure Load Balancer in our software catalog",
"title": "Load Balancer",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"tags": {
"title": "Tags",
"type": "object"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string",
"enum": [
"Succeeded",
"Updating",
"Deleting",
"Failed"
]
},
"frontendIpResourceIds": {
"title": "Frontend IP Resource IDs",
"type": "array"
},
"backendAddressPoolsResourceIds": {
"title": "Backend Address Pools Resource IDs",
"type": "array"
},
"loadBalancingRulesResourceIds": {
"title": "Load Balancing Rules Resource IDs",
"type": "array"
},
"probesResourceIds": {
"title": "Probes Resource IDs",
"type": "array"
},
"inboundNatRulesResourceIds": {
"title": "Inbound NAT Rules Resource IDs",
"type": "array"
},
"inboundNatPoolsResourceIds": {
"title": "Inbound NAT Pools Resource IDs",
"type": "array"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
},

Virtual Machine blueprint
{
"identifier": "azureVirtualMachine",
"description": "This blueprint represents an Azure Virtual Machine in our software catalog",
"title": "Virtual Machine",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"provisioningState": {
"title": "Provisioning State",
"type": "string"
},
"vmSize": {
"title": "VM Size",
"type": "string"
},
"osDiskName": {
"title": "OS Disk Name",
"type": "string"
},
"osDiskType": {
"title": "OS Disk Type",
"type": "string"
},
"osDiskCaching": {
"title": "OS Disk Caching",
"type": "string"
},
"osDiskSizeGB": {
"title": "OS Disk Size GB",
"type": "number"
},
"osDiskCreateOption": {
"title": "OS Disk Create Option",
"type": "string"
},
"networkInterfaceIds": {
"title": "Network Interface IDs",
"type": "array"
},
"licenseType": {
"title": "License Type",
"type": "string"
},
"vmOsProfile": {
"title": "VM OS Profile",
"type": "object"
},
"vmHardwareProfile": {
"title": "VM Hardware Profile",
"type": "object"
},
"vmStorageProfile": {
"title": "VM Storage Profile",
"type": "object"
},
"tags": {
"title": "Tags",
"type": "object"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}
Web App blueprint
{
"identifier": "azureWebApp",
"description": "This blueprint represents an Azure Web App in our software catalog",
"title": "Web App",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"state": {
"title": "State",
"type": "string"
},
"enabled": {
"title": "Enabled",
"type": "boolean"
},
"defaultHostName": {
"title": "Default Host Name",
"type": "string"
},
"appServicePlanId": {
"title": "App Service Plan ID",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}

Mapping Configuration for AKS, ContainerApp, LoadBalancer, VirtualMachine and WebApp

resources:
- kind: Microsoft.App/containerApps
selector:
query: "true"
# azure resource api version to query
apiVersion: "2023-05-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureContainerApp"'
properties:
location: .location
provisioningState: .properties.provisioningState
outboundIpAddresses: .properties.outboundIpAddresses
externalIngress: .properties.configuration.ingress.external
hostName: .properties.configuration.ingress.fqdn
minReplicas: .properties.template.scale.minReplicas
maxReplicas: .properties.template.scale.maxReplicas
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'
- kind: Microsoft.ContainerService/managedClusters
selector:
query: "true"
# azure resource api version to query
apiVersion: "2023-05-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureAks"'
properties:
location: .location
provisioningState: .properties.provisioningState
powerState: .properties.powerState.code
kubernetesVersion: .properties.kubernetesVersion
currentKubernetesVersion: .properties.currentKubernetesVersion
dnsPrefix: .properties.dnsPrefix
fqdn: .properties.fqdn
nodeResourceGroup: .properties.nodeResourceGroup
enableRBAC: .properties.enableRBAC
supportPlan: .properties.supportPlan
networkPlugin: .properties.networkProfile.networkPlugin
podCIDR: .properties.networkProfile.podCidr
serviceCIDR: .properties.networkProfile.serviceCidr
dnsServiceIp: .properties.networkProfile.dnsServiceIP
outboundType: .properties.networkProfile.outboundType
loadBalancerSKU: .properties.networkProfile.loadBalancerSku
maxAgentPools: .properties.maxAgentPools
skuTier: .properties.sku.tier
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'
- kind: Microsoft.Network/loadBalancers
selector:
query: "true"
# azure resource api version to query
apiVersion: "2023-05-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureLoadBalancer"'
properties:
location: .location
provisioningState: .properties.provisioningState
tags: .tags
frontendIpResourceIds: .properties.frontendIPConfigurations[].id
backendAddressPoolResourceIds: .properties.backendAddressPools[].id
loadBalancingRulesResourceIds: .properties.loadBalancingRules[].id
probesResourceIds: .properties.probes[].id
inboundNatRulesResourceIds: .properties.inboundNatRules[].id
inboundNatPoolsResourceIds: .properties.inboundNatPools[].id
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'
- kind: Microsoft.Compute/virtualMachines
selector:
query: "true"
apiVersion: "2023-03-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureVirtualMachine"'
properties:
location: .location
provisioningState: .properties.provisioningState
vmSize: .properties.hardwareProfile.vmSize
osDiskName: .properties.storageProfile.osDisk.name
osType: .properties.storageProfile.osDisk.osType
osDiskCaching: .properties.storageProfile.osDisk.caching
osDiskSizeGB: .properties.storageProfile.osDisk.diskSizeGB
osDiskCreateOption: .properties.storageProfile.osDisk.createOption
networkInterfaceIds: .properties.networkProfile.networkInterfaces[].id
licenseType: .properties.licenseType
vmOsProfile: .properties.osProfile
vmHardwareProfile: .properties.hardwareProfile
vmStorageProfile: .properties.storageProfile
tags: .tags
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase | .[4] |= ascii_downcase | .[:5] |join("/")'
- kind: Microsoft.Web/sites
selector:
query: "true"
apiVersion: "2022-03-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azureWebApp"'
properties:
location: .location
state: .properties.state
enabled: .properties.enabled
defaultHostName: .properties.defaultHostName
appServicePlanId: .properties.serverFarmId
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'

以下是我们用来创建这些蓝图和应用程序配置的 API 引用:

映射数据库资源

在下面的示例中,您将把 Azure 数据库资源引用到 Port,您可以使用下面的 Port 蓝图定义和集成配置:

下面的数据库资源与资源组有关系,因此需要创建Resource Group blueprint
Postgres Flexible Server blueprint
{
"identifier": "azurePostgresFlexibleServer",
"description": "This blueprint represents an Azure Postgres Flexible Server in our software catalog",
"title": "Postgres Flexible Server",
"icon": "Azure",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"version": {
"title": "Version",
"type": "string"
},
"state": {
"title": "State",
"type": "string"
},
"storageSizeGB": {
"title": "Storage Size (GB)",
"type": "number"
},
"activeDirectoryAuth": {
"title": "Active Directory Authentication",
"type": "string",
"enum": ["Enabled", "Disabled"]
},
"passwordAuth": {
"title": "Password Authentication",
"type": "string",
"enum": ["Enabled", "Disabled"]
},
"publicNetworkAccess": {
"title": "Public Network Access",
"type": "string",
"enum": ["Enabled", "Disabled"]
},
"geoRedundantBackup": {
"title": "Geo-Redundant Backup",
"type": "string",
"enum": ["Enabled", "Disabled"]
},
"earliestRestoreDate": {
"title": "Earliest Restore Date",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"resourceGroup": {
"target": "azureResourceGroup",
"title": "Resource Group",
"required": false,
"many": false
}
}
}
Mapping Configuration for Postgres Flexible Server
resources:
- kind: Microsoft.DBforPostgreSQL/flexibleServers
selector:
query: "true"
apiVersion: "2022-12-01"
port:
entity:
mappings:
identifier: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | join("/")'
title: .name
blueprint: '"azurePostgresFlexibleServer"'
properties:
location: .location
version: .properties.version
state: .properties.state
storageSizeGB: .properties.storage.storageSizeGB
activeDirectoryAuth: .properties.authConfig.activeDirectoryAuth
passwordAuth: .properties.authConfig.passwordAuth
publicNetworkAccess: .properties.network.publicNetworkAccess
geoRedundantBackup: .properties.backup.geoRedundantBackup
earliestRestoreDate: .properties.backup.earliestRestoreDate
relations:
resourceGroup: '.id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase | .[:5] |join("/")'

以下是我们用来创建这些蓝图和应用程序配置的 API 引用:

本页面中的资源只是 Azure 输出程序支持的少数资源。 如果没有找到要映射到 Port 的 Azure 资源,请访问Mapping Extra Resources 页面,了解 Azure 集成支持哪些 Azure 资源以及如何将它们映射到 Port。