如何在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
相关产品推荐
相关产品推荐

