# Azure dynamic host catalog - postgresql server not discovered

**URL:** <https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479>\
**Category:** Boundary\
**Tags:** azure\
**Created:** [August 23, 2022, 2:22pm UTC](https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479 "2022-08-23T14:22:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![msamendinger](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/msamendinger/32/27867_2.png) [@msamendinger](https://discuss.hashicorp.com/u/msamendinger)\
**Post date:** [August 23, 2022, 2:22pm UTC](https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479/1 "2022-08-23T14:22:37Z")

</div>

Hi,

I’ve set up a dynamic host catalog on azure and two host sets

```nohighlight
resource "boundary_host_catalog_plugin" "azure" {
  name = "azure_dynamic_host_catalog"
  description = "Dynamic Host Catalog plugin for Azure"
  plugin_name = "azure"
  attributes_json = jsonencode({
    disable_credential_rotation = true
    tenant_id = var.tenant_id
    subscription_id = var.subscription_id
    client_id = var.dynamic_host_catalog_client_id
  })
  secrets_json = jsonencode({
    secret_value = var.dynamic_host_catalog_client_secret
  })
  scope_id = boundary_scope.core_infra.id
}

resource "boundary_host_set_plugin" "ssh" {
  name = "azure_dynamic_host_set_ssh"
  description = "Dynamic Azure host set all systems with tag service-type ssh"
  host_catalog_id = boundary_host_catalog_plugin[0].azure.id
  attributes_json = jsonencode({
    filter = "tagName eq 'service-type' and tagValue eq 'ssh'"
  })
}

resource "boundary_host_set_plugin" "db" {
  name = "azure_dynamic_host_set_db"
  description = "Dynamic Azure host set all systems with tag service-type db"
  host_catalog_id = boundary_host_catalog_plugin[0].azure.id
  attributes_json = jsonencode({
    filter = "tagName eq 'service-type' and tagValue eq 'db'"
  })
}

```

In addition I have tagged a virtual machine with the `service-type:ssh` and a postgresql server with `service-type:db`

```nohighlight
resource "azurerm_linux_virtual_machine" "backend" {
  count = var.backend_vm_count
  name = "${local.backend_vm}-${count.index}"
  location = var.location
  resource_group_name = azurerm_resource_group.boundary.name
  size = var.backend_vm_size
  admin_username = "azureuser"
  computer_name = "backend-${count.index}"
  availability_set_id = azurerm_availability_set.controller.id
  network_interface_ids = [
    azurerm_network_interface.backend[count.index].id,
  ]

  admin_ssh_key {
    username = "azureuser"
    public_key = tls_private_key.boundary.public_key_openssh
  }

  os_disk {
    caching = "ReadWrite"
    storage_account_type = "StandardSSD_LRS"
  }

  source_image_reference {
    publisher = "Canonical"
    offer = "UbuntuServer"
    sku = "18.04-LTS"
    version = "latest"
  }

  tags = {
    service-type = "ssh"
  }
}

resource "azurerm_postgresql_server" "boundary_backend" {
  name = local.backend_db
  location = var.location
  resource_group_name = azurerm_resource_group.boundary.name

  administrator_login = var.db_username
  administrator_login_password = local.db_password

  sku_name = "GP_Gen5_2"
  version = "11"
  storage_mb = 10240

  backup_retention_days = 7
  geo_redundant_backup_enabled = false
  auto_grow_enabled = true

  public_network_access_enabled = false
  ssl_enforcement_enabled = true
  ssl_minimal_tls_version_enforced = "TLS1_2"

  tags = {
    service-type = "db"
  }
}

```

The tags are properly on the resources

```bash
16:18 $ az tag list --resource-id /subscriptions/[redacted]/resourceGroups/msamend-rg/providers/Microsoft.Compute/virtualMachines/backend-0332fcaa-0
{
  "id": "/subscriptions/[redacted]/resourceGroups/msamend-rg/providers/Microsoft.Compute/virtualMachines/backend-0332fcaa-0/providers/Microsoft.Resources/tags/default",
  "name": "default",
  "properties": {
    "tags": {
      "service-type": "ssh"
    }
  },
  "resourceGroup": "msamend-rg",
  "type": "Microsoft.Resources/tags"
}

16:18 $ az tag list --resource-id /subscriptions/[redacted]/resourceGroups/msamend-rg/providers/Microsoft.DBforPostgreSQL/servers/backend-db-0332fcaa
{
  "id": "/subscriptions/[redacted]/resourceGroups/msamend-rg/providers/Microsoft.DBforPostgreSQL/servers/backend-db-0332fcaa/providers/Microsoft.Resources/tags/default",
  "name": "default",
  "properties": {
    "tags": {
      "service-type": "db"
    }
  },
  "resourceGroup": "msamend-rg",
  "type": "Microsoft.Resources/tags"
}

```

and the host sets seem to be properly set up

```bash
16:14 $ boundary host-sets read -id hs_9JbFtOVOhV

Host Set information:
  Created Time: Sun, 21 Aug 2022 22:41:49 CEST
  Description: Dynamic Azure host set all systems with tag service-type db
  Host Catalog ID: hc_y303lUoebD
  ID: hs_9JbFtOVOhV
  Name: azure_dynamic_host_set_db
  Type: plugin
  Updated Time: Tue, 23 Aug 2022 16:07:31 CEST
  Version: 228

  Scope:
    ID: p_sqSV5nSeRJ
    Name: core_infra
    Parent Scope ID: o_2VdoYDMQDZ
    Type: project

  Plugin:
    ID: pl_GXzeSR6y7H
    Name: azure

  Attributes:
    filter: tagName eq 'service-type' and tagValue eq 'db'

  Authorized Actions:
    no-op
    read
    update
    delete

16:14 $ boundary host-sets read -id hs_FNKNUFRufW

Host Set information:
  Created Time: Fri, 19 Aug 2022 15:33:02 CEST
  Description: Dynamic Azure host set all systems with tag service-type ssh
  Host Catalog ID: hc_y303lUoebD
  ID: hs_FNKNUFRufW
  Name: azure_dynamic_host_set_ssh
  Type: plugin
  Updated Time: Tue, 23 Aug 2022 16:07:31 CEST
  Version: 528

  Scope:
    ID: p_sqSV5nSeRJ
    Name: core_infra
    Parent Scope ID: o_2VdoYDMQDZ
    Type: project

  Plugin:
    ID: pl_GXzeSR6y7H
    Name: azure

  Attributes:
    filter: tagName eq 'service-type' and tagValue eq 'ssh'

  Authorized Actions:
    no-op
    read
    update
    delete

  Host IDs:
    h_46lXdGinbM

```

While the ssh host is detected the db is not.

Now I’m a bit lost on how to debug this further, any idea what the problem could be or how I can further debug?

Thanks,  
Marc

---

<div class="post-metadata">

**Author:** ![omkensey](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/omkensey/32/40882_2.png) [@omkensey](https://discuss.hashicorp.com/u/omkensey)\
**Post date:** [August 23, 2022, 2:48pm UTC](https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479/2 "2022-08-23T14:48:36Z")

</div>

I believe that Boundary currently will _only_ detect ordinary VMs in its dynamic host plugins (on both Azure and AWS).

---

<div class="post-metadata">

**Author:** ![msamendinger](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/msamendinger/32/27867_2.png) [@msamendinger](https://discuss.hashicorp.com/u/msamendinger)\
**Post date:** [August 23, 2022, 2:55pm UTC](https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479/3 "2022-08-23T14:55:36Z")

</div>

You are right, as is explicitly stated in the plugins [README.md](https://github.com/hashicorp/boundary-plugin-host-azure).

> Only VMs can be added to host sets through this plugin, not any other type of compute resource

Why haven’t I looked at the GitHub repo earlier.

Thanks @omkensey !

---

<div class="post-metadata">

**Author:** ![jeff](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jeff/32/12882_2.png) [@jeff](https://discuss.hashicorp.com/u/jeff)\
**Post date:** [August 26, 2022, 11:24am UTC](https://discuss.hashicorp.com/t/azure-dynamic-host-catalog-postgresql-server-not-discovered/43479/4 "2022-08-26T11:24:37Z")

</div>

Just a note that although currently limited to VMs we can expand to other types of Azure resources in the future. Just a matter of demand mixed with developer capacity 🙂
