# API - Azure PgSQL database exporter fails

**URL:** <https://forums.percona.com/t/api-azure-pgsql-database-exporter-fails/18693>\
**Category:** PMM 2.x\
**Tags:** closed-no-reply\
**Created:** [November 21, 2022, 2:20pm UTC](https://forums.percona.com/t/api-azure-pgsql-database-exporter-fails/18693 "2022-11-21T14:20:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Straka](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_straka/32/8421_2.png) [@Michael\_Straka](https://forums.percona.com/u/Michael_Straka)\
**Post date:** [November 21, 2022, 2:20pm UTC](https://forums.percona.com/t/api-azure-pgsql-database-exporter-fails/18693/1 "2022-11-21T14:20:15Z")

</div>

Hi all,

I’m trying to automate process of adding new Azure PostgreSQL instance into PMM.  
Via web UI all works just fine (going though _Add Instance → MS Azure → Fill in subscription details,… → Fill in PgSQL details_). It adds the node, creates the service and 3 agents (Azure database exporter, Postgres exporter and QAN PgStatements exported). All works fine.

But now I want to do the same through API.

1. Create node - no problem
2. Create service - no problem
3. Create PostgreSQL Exporter - no problem
4. Create QAN PgStatements exporter - no problem
5. Create Azure Metrics exporter - it creates the agent but its state is **UNKNOWN**

It also looks different in web UI if created via API (see screenshots).

Call this code:

```auto
curl -X 'POST' \
  'https://percona.fcs-sand-emea-001.internal.aks.xxxxx.me/v1/inventory/Agents/AddAzureDatabaseExporter' \
  -H 'accept: application/json' \
  -H 'authorization: Basic YWRtaW46I1o2azVaflJHQ3dybWZxRw==' \
  -H 'Content-Type: application/json' \
  -d '{
  "pmm_agent_id": "pmm-server",
  "node_id": "/node_id/627e6fff-9d06-4b7b-8b34-013888879dd2",
  "azure_client_id": "xxxxxxxxxxxxxxxxxxxxxx",
  "azure_client_secret": "xxxxxxxxxxxxxxxxxxxxxxx",
  "azure_tenant_id": "xxxxxxxxxxxxxxxxxxxxxxx",
  "azure_subscription_id": "xxxxxxxxxxxxxxxxxxxx",
  "azure_resource_group": "rg-emea_we_cslab-PSQL_Service_LAB_001",
  "azure_database_resource_type": "postgres",
  "skip_connection_check": true,
  "push_metrics": true,
  "log_level": "auto"
}'

```

results in:

```auto
{
  "azure_database_exporter": {
    "agent_id": "/agent_id/ccbda484-28fb-4709-9595-c2c0440335fa",
    "pmm_agent_id": "pmm-server",
    "node_id": "/node_id/627e6fff-9d06-4b7b-8b34-013888879dd2",
    "azure_database_subscription_id": "xxxxxxxxxxxxxxxxxxxxx",
    "status": "UNKNOWN"
  }
}

```

Via ‘wizard’:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/7/7bb4254e7a1158ee59c190c7a9a1fd4807d27214.png)  
Running version 2.30

So the question is: am I doing it all wrong? 😃  
Any help would be much appreciated.

Thanks.
