Microsoft。App managedEnvironments/privateEndpointConnections 2025-10-02-preview

Bicep 資源定義

managedEnvironments/privateEndpointConnections 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

資源格式

若要建立 Microsoft.App/managedEnvironments/privateEndpointConnections 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.App/managedEnvironments/privateEndpointConnections@2025-10-02-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    privateEndpoint: {}
    privateLinkServiceConnectionState: {
      actionsRequired: 'string'
      description: 'string'
      status: 'string'
    }
  }
}

屬性值

Microsoft.App/managedEnvironments/privateEndpointConnections

名稱 Description 價值觀
名稱 資源名稱 字串(必填)
父代 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。

如需詳細資訊,請參閱 父資源外部的子資源。
類型資源的符號名稱:managedEnvironments
properties 資源屬性。 PrivateEndpointConnectionProperties

私有端點

名稱 Description 價值觀

PrivateEndpointConnectionProperties

名稱 Description 價值觀
privateEndpoint 私人端點的資源。 私有端點
privateLinkServiceConnectionState 服務取用者與提供者之間連線狀態的相關信息集合。 PrivateLinkServiceConnectionState (必要)

PrivateLinkServiceConnectionState

名稱 Description 價值觀
作必需 訊息,指出服務提供者上的變更是否需要取用者的任何更新。 字串
description 核准/拒絕連線的原因。 字串
狀態 指出服務擁有者是否已核准/拒絕/移除連線。 「已核准」
“斷開連接”
“待定”
“被拒絕”

ARM 樣本資源定義

managedEnvironments/privateEndpointConnections 資源類型可以使用目標作業來部署:

使用範例

資源格式

若要建立 Microsoft.App/managedEnvironments/privateEndpointConnections 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.App/managedEnvironments/privateEndpointConnections",
  "apiVersion": "2025-10-02-preview",
  "name": "string",
  "properties": {
    "privateEndpoint": {
    },
    "privateLinkServiceConnectionState": {
      "actionsRequired": "string",
      "description": "string",
      "status": "string"
    }
  }
}

屬性值

Microsoft.App/managedEnvironments/privateEndpointConnections

名稱 Description 價值觀
apiVersion API 版本 “2025-10-02-預覽”
名稱 資源名稱 字串(必填)
properties 資源屬性。 PrivateEndpointConnectionProperties
型別 資源類型 “Microsoft.App/managedEnvironments/privateEndpointConnections”

私有端點

名稱 Description 價值觀

PrivateEndpointConnectionProperties

名稱 Description 價值觀
privateEndpoint 私人端點的資源。 私有端點
privateLinkServiceConnectionState 服務取用者與提供者之間連線狀態的相關信息集合。 PrivateLinkServiceConnectionState (必要)

PrivateLinkServiceConnectionState

名稱 Description 價值觀
作必需 訊息,指出服務提供者上的變更是否需要取用者的任何更新。 字串
description 核准/拒絕連線的原因。 字串
狀態 指出服務擁有者是否已核准/拒絕/移除連線。 「已核准」
“斷開連接”
“待定”
“被拒絕”

Terraform (AzAPI 提供者) 資源定義

managedEnvironments/privateEndpointConnections 資源類型可以使用目標作業來部署:

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署容器應用程式環境私人端點連線的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest5925"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "workspace" {
  type      = "Microsoft.OperationalInsights/workspaces@2022-10-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      features = {
        disableLocalAuth                            = false
        enableLogAccessUsingOnlyResourcePermissions = true
      }
      publicNetworkAccessForIngestion = "Enabled"
      publicNetworkAccessForQuery     = "Enabled"
      retentionInDays                 = 30
      sku = {
        name = "PerGB2018"
      }
      workspaceCapping = {
        dailyQuotaGb = -1
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

data "azapi_resource_action" "sharedKeys" {
  type                   = "Microsoft.OperationalInsights/workspaces@2020-08-01"
  resource_id            = azapi_resource.workspace.id
  action                 = "sharedKeys"
  response_export_values = ["*"]
}

# Create Virtual Network for private endpoint
resource "azapi_resource" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2023-05-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "${var.resource_name}-vnet"
  location  = var.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = ["10.0.0.0/16"]
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Create Subnet for private endpoint (minimum /27 required for workload profiles)
resource "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2023-05-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = "${var.resource_name}-subnet"
  body = {
    properties = {
      addressPrefix                  = "10.0.0.0/21"
      privateEndpointNetworkPolicies = "Disabled"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Create Container Apps Environment with workload profiles (required for private endpoints)
resource "azapi_resource" "managedEnvironment" {
  type      = "Microsoft.App/managedEnvironments@2024-10-02-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      appLogsConfiguration = {
        destination = "log-analytics"
        logAnalyticsConfiguration = {
          customerId = azapi_resource.workspace.output.properties.customerId
          sharedKey  = data.azapi_resource_action.sharedKeys.output.primarySharedKey
        }
      }
      # Enable workload profiles (default for new environments, but explicitly set)
      workloadProfiles = [
        {
          name                = "Consumption"
          workloadProfileType = "Consumption"
        }
      ]
      # Disable public network access to enable private endpoints
      publicNetworkAccess = "Disabled"
      vnetConfiguration = {
        # Note: For private endpoints, we don't inject into VNet but create separate private endpoint
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Create Private Endpoint for the Container Apps Environment
resource "azapi_resource" "privateEndpoint" {
  type      = "Microsoft.Network/privateEndpoints@2023-05-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "${var.resource_name}-pe"
  location  = var.location
  body = {
    properties = {
      subnet = {
        id = azapi_resource.subnet.id
      }
      privateLinkServiceConnections = [
        {
          name = "${var.resource_name}-connection"
          properties = {
            privateLinkServiceId = azapi_resource.managedEnvironment.id
            groupIds             = ["managedEnvironments"]
          }
        }
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Create Private DNS Zone for Container Apps
resource "azapi_resource" "privateDnsZone" {
  type      = "Microsoft.Network/privateDnsZones@2020-06-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "acctestzone.azurecontainerapps.dev"
  location  = "global"
  body = {
    properties = {}
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Link VNet to Private DNS Zone
resource "azapi_resource" "vnetLink" {
  type      = "Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01"
  parent_id = azapi_resource.privateDnsZone.id
  name      = "${var.resource_name}-vnet-link"
  location  = "global"
  body = {
    properties = {
      virtualNetwork = {
        id = azapi_resource.virtualNetwork.id
      }
      registrationEnabled = false
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

# Create DNS Zone Group for automatic DNS record management
resource "azapi_resource" "privateDnsZoneGroup" {
  type      = "Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2023-05-01"
  parent_id = azapi_resource.privateEndpoint.id
  name      = "default"
  body = {
    properties = {
      privateDnsZoneConfigs = [
        {
          name = "config"
          properties = {
            privateDnsZoneId = azapi_resource.privateDnsZone.id
          }
        }
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

data "azapi_resource_list" "privateEndpointConnections" {
  type                   = "Microsoft.App/managedEnvironments/privateEndpointConnections@2024-10-02-preview"
  parent_id              = azapi_resource.managedEnvironment.id
  response_export_values = ["*"]
}

output "privateEndpointConnections" {
  value = data.azapi_resource_list.privateEndpointConnections.output
}

locals {
  privateEndpointConnectionIds = [
    for pe in data.azapi_resource_list.privateEndpointConnections.output.value : pe.id
  ]
}

# Note: The private endpoint connection is automatically created when the private endpoint is created
# This resource manages the approval state of the connection
resource "azapi_update_resource" "privateEndpointConnection" {
  for_each    = toset(local.privateEndpointConnectionIds)
  type        = "Microsoft.App/managedEnvironments/privateEndpointConnections@2024-10-02-preview"
  resource_id = each.value
  body = {
    properties = {
      privateLinkServiceConnectionState = {
        status          = "Approved"
        description     = "Auto-approved"
        actionsRequired = "None"
      }
    }
  }
}

資源格式

若要建立 Microsoft.App/managedEnvironments/privateEndpointConnections 資源,請將下列 Terraform 新增至您的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.App/managedEnvironments/privateEndpointConnections@2025-10-02-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      privateEndpoint = {
      }
      privateLinkServiceConnectionState = {
        actionsRequired = "string"
        description = "string"
        status = "string"
      }
    }
  }
}

屬性值

Microsoft.App/managedEnvironments/privateEndpointConnections

名稱 Description 價值觀
名稱 資源名稱 字串(必填)
parent_id 此資源為父系之資源的標識碼。 類型的資源標識碼:managedEnvironments
properties 資源屬性。 PrivateEndpointConnectionProperties
型別 資源類型 “Microsoft.App/managedEnvironments/privateEndpointConnections@2025-10-02-preview”

私有端點

名稱 Description 價值觀

PrivateEndpointConnectionProperties

名稱 Description 價值觀
privateEndpoint 私人端點的資源。 私有端點
privateLinkServiceConnectionState 服務取用者與提供者之間連線狀態的相關信息集合。 PrivateLinkServiceConnectionState (必要)

PrivateLinkServiceConnectionState

名稱 Description 價值觀
作必需 訊息,指出服務提供者上的變更是否需要取用者的任何更新。 字串
description 核准/拒絕連線的原因。 字串
狀態 指出服務擁有者是否已核准/拒絕/移除連線。 「已核准」
“斷開連接”
“待定”
“被拒絕”