Microsoft.Network 堡壘主機

Bicep 資源定義

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

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

使用範例

Bicep 範例

部署堡壘主機的基本範例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource bastionHost 'Microsoft.Network/bastionHosts@2022-07-01' = {
  name: resourceName
  location: location
  sku: {
    name: 'Basic'
  }
  properties: {
    disableCopyPaste: false
    enableFileCopy: false
    enableIpConnect: false
    enableShareableLink: false
    enableTunneling: false
    ipConfigurations: [
      {
        name: 'ip-configuration'
        properties: {
          publicIPAddress: {
            id: publicIPAddress.id
          }
          subnet: {
            id: subnet.id
          }
        }
      }
    ]
    scaleUnits: 2
  }
}

resource publicIPAddress 'Microsoft.Network/publicIPAddresses@2022-07-01' = {
  name: resourceName
  location: location
  sku: {
    name: 'Standard'
    tier: 'Regional'
  }
  properties: {
    ddosSettings: {
      protectionMode: 'VirtualNetworkInherited'
    }
    idleTimeoutInMinutes: 4
    publicIPAddressVersion: 'IPv4'
    publicIPAllocationMethod: 'Static'
  }
}

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = {
  name: resourceName
  location: location
  properties: {
    addressSpace: {
      addressPrefixes: [
        '192.168.1.0/24'
      ]
    }
    dhcpOptions: {
      dnsServers: []
    }
    subnets: []
  }
}

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2022-07-01' = {
  name: 'AzureBastionSubnet'
  parent: virtualNetwork
  properties: {
    addressPrefix: '192.168.1.224/27'
    delegations: []
    privateEndpointNetworkPolicies: 'Enabled'
    privateLinkServiceNetworkPolicies: 'Enabled'
    serviceEndpointPolicies: []
    serviceEndpoints: []
  }
}

Azure 已驗證的模組

下列 Azure 驗證模組 可用來部署此資源類型。

模組 描述
堡壘宿主 Bastion 主機的AVM資源模組

Azure 快速入門範例

下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔案 描述
具備 NAT 閘道與應用閘道的 AKS 叢集 此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及用於輸入連線的應用程式閘道。
具備 Application Gateway Ingress 控制器的 AKS 叢集 此範例示範如何使用應用程式閘道、應用程式閘道輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集
Azure Bastion as a Service 此範本會在虛擬網路中布建 Azure Bastion
Azure Bastion as a Service with NSG 此範本會在虛擬網路中布建 Azure Bastion
Azure Machine Learning 端對端安全安裝 這組 Bicep 範本示範如何在安全設定中設定 Azure Machine Learning 端對端。 此參考實作包括工作區、計算叢集、計算實例和附加的私人 AKS 叢集。
Azure Machine Learning 端對端安全安裝(legacy) 這組 Bicep 範本示範如何在安全設定中設定 Azure Machine Learning 端對端。 此參考實作包括工作區、計算叢集、計算實例和附加的私人 AKS 叢集。
建立跨區域負載平衡器 此範本會建立跨區域負載平衡器,其後端集區包含兩個區域負載平衡器。 跨區域負載平衡器目前可在有限的區域中使用。 跨區域負載平衡器背後的區域負載平衡器可以在任何區域中。
建立私人 AKS 叢集 此範例示範如何在虛擬網路中建立私人 AKS 叢集,以及 jumpbox 虛擬機。
建立標準內部負載平衡器 此範本會建立具有規則負載平衡埠 80 的標準內部 Azure Load Balancer
建立標準負載平衡器 此範本會為後端集區建立因特網面向的負載平衡器、負載平衡規則和三部 VM,並在備援區域中每個 VM。
在樞紐 虛擬網路 中部署 Bastion 主機 此範本會建立兩個具有對等互連的 vNet、中樞 vNet 中的 Bastion 主機,以及輪輻 vNet 中的 Linux VM
部署 Secure AI Foundry 並搭配受管理的虛擬網路 此範本創建具有強大網路和標識安全限制的安全 Azure AI Foundry 環境。
Hub-Spoke 網路搭配 NAT 閘道與 Azure 防火牆 部署帶有 NAT 閘道、Azure 防火牆及虛擬機的樞紐輻射網路拓撲
連結至 Gateway Load Balancer 的 Public Load Balancer 此範本可讓您部署鏈結至閘道 Load Balancer 的公用標準 Load Balancer。 來自因特網的流量會路由傳送至後端集區中具有Linux VM(NVA)的網關負載平衡器。
Azure 防火牆 Premium 的測試環境 此範本會建立具有進階功能的 Azure 防火牆進階和防火牆原則,例如入侵檢測 (IDPS)、TLS 檢查和 Web 類別篩選
在樞紐與 Hub 中使用 Azure 防火牆 作為 DNS 代理輻射拓撲 此範例示範如何使用 Azure 防火牆在 Azure 中部署中樞輪輻拓撲。 中樞虛擬網路可作為透過虛擬網路對等互連連線到中樞虛擬網路之許多輪輻虛擬網路的中央點。
虛擬網路 NAT 與 VM 部署 NAT 閘道和虛擬機

資源格式

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

resource symbolicname 'Microsoft.Network/bastionHosts@2026-05-01' = {
  identity: {
    type: 'string'
    userAssignedIdentities: {
      {customized property}: {}
    }
  }
  location: 'string'
  name: 'string'
  properties: {
    disableCopyPaste: bool
    dnsName: 'string'
    enableFileCopy: bool
    enableIpConnect: bool
    enableKerberos: bool
    enablePrivateOnlyBastion: bool
    enableSessionRecording: bool
    enableShareableLink: bool
    enableTunneling: bool
    ipConfigurations: [
      {
        id: 'string'
        name: 'string'
        properties: {
          privateIPAllocationMethod: 'string'
          publicIPAddress: {
            id: 'string'
          }
          subnet: {
            id: 'string'
          }
        }
      }
    ]
    networkAcls: {
      ipRules: [
        {
          addressPrefix: 'string'
        }
      ]
    }
    scaleUnits: int
    sessionRecordingConfiguration: {
      blobContainerUri: 'string'
      identity: {
        type: 'string'
        userAssignedIdentityId: 'string'
      }
    }
    virtualNetwork: {
      id: 'string'
    }
  }
  sku: {
    name: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
  zones: [
    'string'
  ]
}

屬性值

Microsoft.Network/堡壘主機

名字 描述 價值
身分識別 Bastion Host 資源所指派的身份 ManagedServiceIdentity
位置 資源位置。 字串
名字 資源名稱 字串 (必要)
性能 表示防禦主機資源。 BastionHostPropertiesFormat(堡壘主機屬性格式)
SKU 此 Bastion 主機的 SKU。 Sku
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
區 可用性區域清單,表示資源需要來自何處。 字串[]

BastionHostIPConfiguration

名字 描述 價值
識別碼 資源標識碼。 字串
名字 資源群組內唯一的資源名稱。 此名稱可用來存取資源。 字串
性能 表示與資源相關聯的IP組態。 BastionHostIPConfigurationPropertiesFormat

BastionHostIPConfigurationPropertiesFormat

名字 描述 價值
privateIPAllocationMethod 私人IP配置方法。 “動態”
“靜態”
publicIPAddress 位址 PublicIP 資源的參考。 僅限私人防禦的 Null 子資源
子網路 子網資源的參考。 SubResource (必填)

BastionHostPropertiesFormat

名字 描述 價值
禁用CopyPaste 啟用/停用 Bastion 主機資源的複製/貼上功能。 布爾 (bool)
dns名稱 可存取防禦主機之端點的 FQDN。 字串
enableFileCopy 啟用/停用 Bastion 主機資源的檔案複製功能。 布爾 (bool)
啟用 IpConnect 啟用/停用 Bastion 主機資源的 IP Connect 功能。 布爾 (bool)
enableKerberos 啟用/停用 Bastion 主機資源的 Kerberos 功能。 布爾 (bool)
enablePrivateOnlyBastion 啟用/停用 Bastion 主機資源的僅限私人功能。 布爾 (bool)
enableSessionRecording 啟用/停用 Bastion 主機資源的會話錄製功能。 布爾 (bool)
enableShareableLink 啟用/停用 Bastion 主機資源的可共享連結。 布爾 (bool)
enableTunneling 啟用/停用 Bastion 主機資源的通道功能。 布爾 (bool)
ip配置 Bastion 主機資源的IP組態。 BastionHostIPConfiguration[]
網路 Acls BastionHostPropertiesFormatNetworkAcls
scaleUnits Bastion 主機資源的縮放單位。 int

約束:
最小值 = 2
最大值 = 50
sessionRecordingConfiguration 用於會話錄製的儲存帳號與身份 BastionSessionRecordingConfiguration
虛擬網路 僅限開發人員 Bastion 主機所需的現有虛擬網路參考。 子資源

BastionHostPropertiesFormatNetworkAcls

名字 描述 價值
ip規則 設定開發人員 Bastion 主機的 IP ACL 規則。 IPRule[]

BastionSessionRecordingConfiguration

名字 描述 價值
blobContainerUri 用來存放錄音的膠狀容器。 例如:https://contosostorage.blob.core.windows.net/contosorecordings。 字串 (必要)
身分識別 用來存取儲存錄影的 blob 容器的身份碼 SessionRecordingIdentity (必填)

IPRule

名字 描述 價值
addressPrefix 的 以 CIDR 格式指定 IP 或 IP 範圍。 只允許 IPV4 位址。 字串

ManagedServiceIdentity

名字 描述 價值
型別 用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。 'None'
'SystemAssigned'
'SystemAssigned, UserAssigned'
'UserAssigned'
userAssignedIdentities 與資源相關聯的使用者身分識別清單。 使用者身份字典的金鑰參考會是 ARM 資源 ID,格式為:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft。ManagedIdentity/userAssignedIdentities/{identityName}'. ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

錄音錄音身份

名字 描述 價值
型別 應使用的身份類型 'SystemAssigned'
'UserAssigned' (必要)
使用者分配身份ID 使用者指定的身份用於存取 blob 容器 Uri。 例如:/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<資源群組>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId。 互斥的身份類型系統指派。 字串

SKU

名字 描述 價值
名字 這個 Bastion 主機的 SKU 名稱。 “基本”
“開發商”
“高級”
“標準”

子資源

名字 描述 價值
識別碼 資源標識碼。 字串

ARM 樣本資源定義

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

使用範例

Azure 快速入門範本

下列 Azure 快速入門範本 部署此資源類型。

範本 描述
具備 NAT 閘道與應用閘道的 AKS 叢集

部署至 Azure
此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及用於輸入連線的應用程式閘道。
具備 Application Gateway Ingress 控制器的 AKS 叢集

部署至 Azure
此範例示範如何使用應用程式閘道、應用程式閘道輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集
Azure Bastion as a Service

部署至 Azure
此範本會在虛擬網路中布建 Azure Bastion
Azure Bastion as a Service with NSG

部署至 Azure
此範本會在虛擬網路中布建 Azure Bastion
Azure Machine Learning 端對端安全安裝

部署至 Azure
這組 Bicep 範本示範如何在安全設定中設定 Azure Machine Learning 端對端。 此參考實作包括工作區、計算叢集、計算實例和附加的私人 AKS 叢集。
Azure Machine Learning 端對端安全安裝(legacy)

部署至 Azure
這組 Bicep 範本示範如何在安全設定中設定 Azure Machine Learning 端對端。 此參考實作包括工作區、計算叢集、計算實例和附加的私人 AKS 叢集。
建立跨區域負載平衡器

部署至 Azure
此範本會建立跨區域負載平衡器,其後端集區包含兩個區域負載平衡器。 跨區域負載平衡器目前可在有限的區域中使用。 跨區域負載平衡器背後的區域負載平衡器可以在任何區域中。
建立私人 AKS 叢集

部署至 Azure
此範例示範如何在虛擬網路中建立私人 AKS 叢集,以及 jumpbox 虛擬機。
建立具有公用 DNS 區域的私有 AKS 叢集

部署至 Azure
此範例示範如何使用公用 DNS 區域部署私人 AKS 叢集。
建立標準內部負載平衡器

部署至 Azure
此範本會建立具有規則負載平衡埠 80 的標準內部 Azure Load Balancer
建立標準負載平衡器

部署至 Azure
此範本會為後端集區建立因特網面向的負載平衡器、負載平衡規則和三部 VM,並在備援區域中每個 VM。
在樞紐 虛擬網路 中部署 Bastion 主機

部署至 Azure
此範本會建立兩個具有對等互連的 vNet、中樞 vNet 中的 Bastion 主機,以及輪輻 vNet 中的 Linux VM
部署 Darktrace 自動縮放 vSensors

部署至 Azure
此範本可讓您部署 Darktrace vSensors 的自動自動調整部署
部署 Secure AI Foundry 並搭配受管理的虛擬網路

部署至 Azure
此範本創建具有強大網路和標識安全限制的安全 Azure AI Foundry 環境。
範例參數化部署搭配連結範本

部署至 Azure
此範例範本會將多層資源部署到 Azure 資源群組。 每一層都有可設定的元素,以示範如何將參數化公開給使用者。
Hub-Spoke 網路搭配 NAT 閘道與 Azure 防火牆

部署至 Azure
部署帶有 NAT 閘道、Azure 防火牆及虛擬機的樞紐輻射網路拓撲
連結至 Gateway Load Balancer 的 Public Load Balancer

部署至 Azure
此範本可讓您部署鏈結至閘道 Load Balancer 的公用標準 Load Balancer。 來自因特網的流量會路由傳送至後端集區中具有Linux VM(NVA)的網關負載平衡器。
Standard Load Balancer 搭配 IP 位址後端池

部署至 Azure
此範本用來示範如何使用ARM範本,依IP位址設定負載平衡器的後端集區,如 後端集區管理 檔中所述。
Azure 防火牆 Premium 的測試環境

部署至 Azure
此範本會建立具有進階功能的 Azure 防火牆進階和防火牆原則,例如入侵檢測 (IDPS)、TLS 檢查和 Web 類別篩選
在樞紐與 Hub 中使用 Azure 防火牆 作為 DNS 代理輻射拓撲

部署至 Azure
此範例示範如何使用 Azure 防火牆在 Azure 中部署中樞輪輻拓撲。 中樞虛擬網路可作為透過虛擬網路對等互連連線到中樞虛擬網路之許多輪輻虛擬網路的中央點。
虛擬網路 NAT 與 VM

部署至 Azure
部署 NAT 閘道和虛擬機

資源格式

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

{
  "type": "Microsoft.Network/bastionHosts",
  "apiVersion": "2026-05-01",
  "name": "string",
  "identity": {
    "type": "string",
    "userAssignedIdentities": {
      "{customized property}": {
      }
    }
  },
  "location": "string",
  "properties": {
    "disableCopyPaste": "bool",
    "dnsName": "string",
    "enableFileCopy": "bool",
    "enableIpConnect": "bool",
    "enableKerberos": "bool",
    "enablePrivateOnlyBastion": "bool",
    "enableSessionRecording": "bool",
    "enableShareableLink": "bool",
    "enableTunneling": "bool",
    "ipConfigurations": [
      {
        "id": "string",
        "name": "string",
        "properties": {
          "privateIPAllocationMethod": "string",
          "publicIPAddress": {
            "id": "string"
          },
          "subnet": {
            "id": "string"
          }
        }
      }
    ],
    "networkAcls": {
      "ipRules": [
        {
          "addressPrefix": "string"
        }
      ]
    },
    "scaleUnits": "int",
    "sessionRecordingConfiguration": {
      "blobContainerUri": "string",
      "identity": {
        "type": "string",
        "userAssignedIdentityId": "string"
      }
    },
    "virtualNetwork": {
      "id": "string"
    }
  },
  "sku": {
    "name": "string"
  },
  "tags": {
    "{customized property}": "string"
  },
  "zones": [ "string" ]
}

屬性值

Microsoft.Network/堡壘主機

名字 描述 價值
apiVersion API 版本 '2026-05-01'
身分識別 Bastion Host 資源所指派的身份 ManagedServiceIdentity
位置 資源位置。 字串
名字 資源名稱 字串 (必要)
性能 表示防禦主機資源。 BastionHostPropertiesFormat(堡壘主機屬性格式)
SKU 此 Bastion 主機的 SKU。 Sku
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 “Microsoft.Network/bastionHosts”
區 可用性區域清單,表示資源需要來自何處。 字串[]

BastionHostIPConfiguration

名字 描述 價值
識別碼 資源標識碼。 字串
名字 資源群組內唯一的資源名稱。 此名稱可用來存取資源。 字串
性能 表示與資源相關聯的IP組態。 BastionHostIPConfigurationPropertiesFormat

BastionHostIPConfigurationPropertiesFormat

名字 描述 價值
privateIPAllocationMethod 私人IP配置方法。 “動態”
“靜態”
publicIPAddress 位址 PublicIP 資源的參考。 僅限私人防禦的 Null 子資源
子網路 子網資源的參考。 SubResource (必填)

BastionHostPropertiesFormat

名字 描述 價值
禁用CopyPaste 啟用/停用 Bastion 主機資源的複製/貼上功能。 布爾 (bool)
dns名稱 可存取防禦主機之端點的 FQDN。 字串
enableFileCopy 啟用/停用 Bastion 主機資源的檔案複製功能。 布爾 (bool)
啟用 IpConnect 啟用/停用 Bastion 主機資源的 IP Connect 功能。 布爾 (bool)
enableKerberos 啟用/停用 Bastion 主機資源的 Kerberos 功能。 布爾 (bool)
enablePrivateOnlyBastion 啟用/停用 Bastion 主機資源的僅限私人功能。 布爾 (bool)
enableSessionRecording 啟用/停用 Bastion 主機資源的會話錄製功能。 布爾 (bool)
enableShareableLink 啟用/停用 Bastion 主機資源的可共享連結。 布爾 (bool)
enableTunneling 啟用/停用 Bastion 主機資源的通道功能。 布爾 (bool)
ip配置 Bastion 主機資源的IP組態。 BastionHostIPConfiguration[]
網路 Acls BastionHostPropertiesFormatNetworkAcls
scaleUnits Bastion 主機資源的縮放單位。 int

約束:
最小值 = 2
最大值 = 50
sessionRecordingConfiguration 用於會話錄製的儲存帳號與身份 BastionSessionRecordingConfiguration
虛擬網路 僅限開發人員 Bastion 主機所需的現有虛擬網路參考。 子資源

BastionHostPropertiesFormatNetworkAcls

名字 描述 價值
ip規則 設定開發人員 Bastion 主機的 IP ACL 規則。 IPRule[]

BastionSessionRecordingConfiguration

名字 描述 價值
blobContainerUri 用來存放錄音的膠狀容器。 例如:https://contosostorage.blob.core.windows.net/contosorecordings。 字串 (必要)
身分識別 用來存取儲存錄影的 blob 容器的身份碼 SessionRecordingIdentity (必填)

IPRule

名字 描述 價值
addressPrefix 的 以 CIDR 格式指定 IP 或 IP 範圍。 只允許 IPV4 位址。 字串

ManagedServiceIdentity

名字 描述 價值
型別 用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。 'None'
'SystemAssigned'
'SystemAssigned, UserAssigned'
'UserAssigned'
userAssignedIdentities 與資源相關聯的使用者身分識別清單。 使用者身份字典的金鑰參考會是 ARM 資源 ID,格式為:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft。ManagedIdentity/userAssignedIdentities/{identityName}'. ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

錄音錄音身份

名字 描述 價值
型別 應使用的身份類型 'SystemAssigned'
'UserAssigned' (必要)
使用者分配身份ID 使用者指定的身份用於存取 blob 容器 Uri。 例如:/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<資源群組>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId。 互斥的身份類型系統指派。 字串

SKU

名字 描述 價值
名字 這個 Bastion 主機的 SKU 名稱。 “基本”
“開發商”
“高級”
“標準”

子資源

名字 描述 價值
識別碼 資源標識碼。 字串

Terraform (AzAPI 提供者) 資源定義

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

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

使用範例

Terraform 範例

部署堡壘主機的基本範例。

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

provider "azapi" {
  skip_provider_registration = false
}

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

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" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = [
          "192.168.1.0/24",
        ]
      }
      dhcpOptions = {
        dnsServers = [
        ]
      }
      subnets = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
  lifecycle {
    ignore_changes = [body.properties.subnets]
  }
}

resource "azapi_resource" "publicIPAddress" {
  type      = "Microsoft.Network/publicIPAddresses@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      ddosSettings = {
        protectionMode = "VirtualNetworkInherited"
      }
      idleTimeoutInMinutes     = 4
      publicIPAddressVersion   = "IPv4"
      publicIPAllocationMethod = "Static"
    }
    sku = {
      name = "Standard"
      tier = "Regional"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = "AzureBastionSubnet"
  body = {
    properties = {
      addressPrefix = "192.168.1.224/27"
      delegations = [
      ]
      privateEndpointNetworkPolicies    = "Enabled"
      privateLinkServiceNetworkPolicies = "Enabled"
      serviceEndpointPolicies = [
      ]
      serviceEndpoints = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "bastionHost" {
  type      = "Microsoft.Network/bastionHosts@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      disableCopyPaste    = false
      enableFileCopy      = false
      enableIpConnect     = false
      enableShareableLink = false
      enableTunneling     = false
      ipConfigurations = [
        {
          name = "ip-configuration"
          properties = {
            publicIPAddress = {
              id = azapi_resource.publicIPAddress.id
            }
            subnet = {
              id = azapi_resource.subnet.id
            }
          }
        },
      ]
      scaleUnits = 2
    }
    sku = {
      name = "Basic"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Azure 已驗證的模組

下列 Azure 驗證模組 可用來部署此資源類型。

模組 描述
堡壘宿主 Bastion 主機的AVM資源模組

資源格式

若要建立 Microsoft.Network/bastionHosts 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Network/bastionHosts@2026-05-01"
  name = "string"
  parent_id = "string"
  identity {
    type = "string"
    identity_ids = [
      "string"
    ]
  }
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      disableCopyPaste = bool
      dnsName = "string"
      enableFileCopy = bool
      enableIpConnect = bool
      enableKerberos = bool
      enablePrivateOnlyBastion = bool
      enableSessionRecording = bool
      enableShareableLink = bool
      enableTunneling = bool
      ipConfigurations = [
        {
          id = "string"
          name = "string"
          properties = {
            privateIPAllocationMethod = "string"
            publicIPAddress = {
              id = "string"
            }
            subnet = {
              id = "string"
            }
          }
        }
      ]
      networkAcls = {
        ipRules = [
          {
            addressPrefix = "string"
          }
        ]
      }
      scaleUnits = int
      sessionRecordingConfiguration = {
        blobContainerUri = "string"
        identity = {
          type = "string"
          userAssignedIdentityId = "string"
        }
      }
      virtualNetwork = {
        id = "string"
      }
    }
    sku = {
      name = "string"
    }
    zones = [
      "string"
    ]
  }
}

屬性值

Microsoft.Network/堡壘主機

名字 描述 價值
身分識別 Bastion Host 資源所指派的身份 ManagedServiceIdentity
位置 資源位置。 字串
名字 資源名稱 字串 (必要)
性能 表示防禦主機資源。 BastionHostPropertiesFormat(堡壘主機屬性格式)
SKU 此 Bastion 主機的 SKU。 Sku
標籤 資源標籤 標記名稱和值的字典。
型別 資源類型 「Microsoft。Network/bastionHosts@2026-05-01」
區 可用性區域清單,表示資源需要來自何處。 字串[]

BastionHostIPConfiguration

名字 描述 價值
識別碼 資源標識碼。 字串
名字 資源群組內唯一的資源名稱。 此名稱可用來存取資源。 字串
性能 表示與資源相關聯的IP組態。 BastionHostIPConfigurationPropertiesFormat

BastionHostIPConfigurationPropertiesFormat

名字 描述 價值
privateIPAllocationMethod 私人IP配置方法。 “動態”
“靜態”
publicIPAddress 位址 PublicIP 資源的參考。 僅限私人防禦的 Null 子資源
子網路 子網資源的參考。 SubResource (必填)

BastionHostPropertiesFormat

名字 描述 價值
禁用CopyPaste 啟用/停用 Bastion 主機資源的複製/貼上功能。 布爾 (bool)
dns名稱 可存取防禦主機之端點的 FQDN。 字串
enableFileCopy 啟用/停用 Bastion 主機資源的檔案複製功能。 布爾 (bool)
啟用 IpConnect 啟用/停用 Bastion 主機資源的 IP Connect 功能。 布爾 (bool)
enableKerberos 啟用/停用 Bastion 主機資源的 Kerberos 功能。 布爾 (bool)
enablePrivateOnlyBastion 啟用/停用 Bastion 主機資源的僅限私人功能。 布爾 (bool)
enableSessionRecording 啟用/停用 Bastion 主機資源的會話錄製功能。 布爾 (bool)
enableShareableLink 啟用/停用 Bastion 主機資源的可共享連結。 布爾 (bool)
enableTunneling 啟用/停用 Bastion 主機資源的通道功能。 布爾 (bool)
ip配置 Bastion 主機資源的IP組態。 BastionHostIPConfiguration[]
網路 Acls BastionHostPropertiesFormatNetworkAcls
scaleUnits Bastion 主機資源的縮放單位。 int

約束:
最小值 = 2
最大值 = 50
sessionRecordingConfiguration 用於會話錄製的儲存帳號與身份 BastionSessionRecordingConfiguration
虛擬網路 僅限開發人員 Bastion 主機所需的現有虛擬網路參考。 子資源

BastionHostPropertiesFormatNetworkAcls

名字 描述 價值
ip規則 設定開發人員 Bastion 主機的 IP ACL 規則。 IPRule[]

BastionSessionRecordingConfiguration

名字 描述 價值
blobContainerUri 用來存放錄音的膠狀容器。 例如:https://contosostorage.blob.core.windows.net/contosorecordings。 字串 (必要)
身分識別 用來存取儲存錄影的 blob 容器的身份碼 SessionRecordingIdentity (必填)

IPRule

名字 描述 價值
addressPrefix 的 以 CIDR 格式指定 IP 或 IP 範圍。 只允許 IPV4 位址。 字串

ManagedServiceIdentity

名字 描述 價值
型別 用於資源的身分識別類型。 類型 'SystemAssigned, UserAssigned' 包含隱含建立的身分識別和一組使用者指派的身分識別。 類型 『None』 會從虛擬機中移除任何身分識別。 'None'
'SystemAssigned'
'SystemAssigned, UserAssigned'
'UserAssigned'
userAssignedIdentities 與資源相關聯的使用者身分識別清單。 使用者身份字典的金鑰參考會是 ARM 資源 ID,格式為:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft。ManagedIdentity/userAssignedIdentities/{identityName}'. ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

錄音錄音身份

名字 描述 價值
型別 應使用的身份類型 'SystemAssigned'
'UserAssigned' (必要)
使用者分配身份ID 使用者指定的身份用於存取 blob 容器 Uri。 例如:/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<資源群組>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId。 互斥的身份類型系統指派。 字串

SKU

名字 描述 價值
名字 這個 Bastion 主機的 SKU 名稱。 “基本”
“開發商”
“高級”
“標準”

子資源

名字 描述 價值
識別碼 資源標識碼。 字串