You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Bicep/ARM部署期间获取Azure Database for PostgreSQL Flexible Server私有IP?

获取Azure Database for PostgreSQL Flexible Server私有IP地址的属性说明

Azure Database for PostgreSQL Flexible Server的私有IP地址可直接通过服务器对象本身的属性获取,无需依赖子资源或专用DNS区域,具体如下:

  • ARM模板(JSON):部署完成后,可通过服务器资源的properties.privateIpAddress属性获取私有IP。例如引用已部署的服务器:

    "[reference(resourceId('Microsoft.DBforPostgreSQL/flexibleServers', 'your-server-name')).properties.privateIpAddress]"
    
  • Bicep:直接访问服务器资源的properties.privateIpAddress属性即可,示例代码:

    resource postgresServer 'Microsoft.DBforPostgreSQL/flexibleServers@2023-06-01-preview' existing = {
      name: 'your-server-name'
    }
    
    output privateIpAddress string = postgresServer.properties.privateIpAddress
    

注意:该属性仅在服务器配置为**私有访问(VNet集成)**模式下返回有效IP值;若为公共访问模式,此属性不会返回内容。

内容的提问来源于stack exchange,提问作者SvenAelterman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 13:50:32