Azure Postgres Flexible ARM deployments fail when adding multiple extensions

Greg H 35 Reputation points
2024-01-19T15:35:56.35+00:00

I have a bicep deployment that is attempting to add the following extensions to a postgres flexible instance. I am deploying postgres 15

resource postgresql 'Microsoft.DBforPostgreSQL/flexibleServers/configurations@2023-06-01-preview' = {
  parent: postgreSQL
  name: 'azure.extensions'
  properties: {
    value: 'address_standardizer,address_standardizer_data_us,amcheck,bloom,btree_gin,btree_gist,citext,cube,dblink,dict_int,dict_xsyn,earthdistance,fuzzystrmatch,hstore,intagg,intarray,isn,lo,ltree,pageinspect,pg_buffercache,pg_freespacemap,pg_partman,pg_prewarm,pg_stat_statements,pg_trgm,pg_visibility,pgaudit,pgcrypto,pgrowlocks,pglogical,pgstattuple,plpgsql,postgis,postgis_sfcgal,postgis_tiger_geocoder,postgis_topology,postgres_fdw,sslinfo,tablefunc,tsm_system_rows,tsm_system_time,unaccent,uuid-ossp,lo,hypopg,postgis_raster'
    source: 'user-override'
  }
}

This frequently fails with the following. However sometime it passes. How do I prevent this from happening. There should be some reliability to deployments. On a side note with previous versions of postgres 12 this step was not required as these extensions were added by default. It appears at some point the default extensions where changed. Microsoft does not provide any documentation on what extensions are enabled on a particular version of postgres flexible. This I believe needs to be fixed as well.

The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'. (Code: ResourceDeploymentFailure, Target: /subscriptions/{subscription-id}/resourceGroups/my-resource-group/providers/Microsoft.DBforPostgreSQL/flexibleServers/my-server-name/configurations/azure.extensions)
Azure Database for PostgreSQL
{count} vote

2 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 20,911 Reputation points Microsoft Employee Moderator
    2024-01-19T18:43:16.1966667+00:00

    @Greg H Thank you for reaching out.

    I’m sorry to hear that you’re experiencing issues with your Bicep deployment.

    1. Ensure that the extensions you’re trying to add are compatible with the version of PostgreSQL you’re using. As you mentioned, the default extensions may have changed between versions, so it’s possible that some extensions are no longer supported.
    2. Consider using a different deployment method, such as the Azure Portal or Azure CLI.

    Regarding your second question, Microsoft provides documentation on the extensions that are enabled for each version of PostgreSQL Flexible Server. PostgreSQL extensions in Azure Database for PostgreSQL - Flexible Server Regards,

    Oury

    0 comments No comments

  2. Greg H 35 Reputation points
    2024-01-19T22:29:45.6333333+00:00

    I've done some more testing and it does appear to be a race condition. If I move the extensions resource creation behind the firewall rules and add a depends on it seems to resolve the issue. I'm guessing because the prior postgres deployment takes the server offline and it does not come back up fast enough for the extensions to be applied. The extra little delay of updating the firewall resources seems to help. Hopefully this will help in your internal investigation. Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.