Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connected_devices information in azure_virtual_network and azure_subnet tables #815

Closed
marcbrlcln opened this issue Jul 31, 2024 · 5 comments · Fixed by #822
Closed
Assignees
Labels
enhancement New feature or request

Comments

@marcbrlcln
Copy link

Describe the solution you'd like
We'd like to check that a virtual network or subnet has connected devices. To do this, it'd be useful to have a column for connected devices in these tables.

@marcbrlcln marcbrlcln added the enhancement New feature or request label Jul 31, 2024
@ParthaI ParthaI self-assigned this Aug 9, 2024
@ParthaI
Copy link
Contributor

ParthaI commented Aug 9, 2024

Hello @marcbrlcln,

Could you please provide a bit more detail about what you mean by connected_device? This will help us identify the relevant API support.

Are you referring to the NICs attached to the VM, or is there something else you're looking for?

@marcbrlcln
Copy link
Author

Hello,

Sorry for the lack of information.

What I wanted is the information in the following screenshot where the type of the resources can be a NIC, a Load Balancer, an Application Gateway, a Firewall and more.
Capture d'écran 2024-08-09 172624

I thought it would be possible to have a "Connected devices" column in the azure_virtual_network and azure_subnet tables as in the screen. But, I realized that this information is already in the azure_subnet table in the ip_configurations column.

However, I am experiencing an issue with the ip_configurations column where some details are missing.

Context
In my subscription I have one Virtual Network with five subnets in which there are some NICs, a load balancer, a firewall and a Virtual network gateway. For exemple, here is the subnet with the firewall in Azure CLI :

az network vnet subnet list --resource-group rg-demo --vnet-name vnet-demo  
[
  {
    "addressPrefix": "10.48.0.192/26",
    "delegations": [],
    "etag": "W/\"eb.................................\"",
    "id": "/subscriptions/d3................................./resourceGroups/rg-demo/providers/Microsoft.Network/virtualNetworks/vnet-demo/subnets/AzureFirewallSubnet",
    "ipConfigurations": [
      {
        "id": "/subscriptions/d3................................./resourceGroups/rg-demo/providers/Microsoft.Network/azureFirewalls/afw-demo/azureFirewallIpConfigurations/IP_CONFIGURATION",
        "resourceGroup": "rg-demo"
      }
    ],
    "name": "AzureFirewallSubnet",
    "privateEndpointNetworkPolicies": "Enabled",
    "privateLinkServiceNetworkPolicies": "Enabled",
    "provisioningState": "Succeeded",
    "resourceGroup": "rg-demo",
    "routeTable": {
      "id": "/subscriptions/d3................................./resourceGroups/rg-demo/providers/Microsoft.Network/routeTables/udr-demo",
      "resourceGroup": "rg-demo"
    },
    "serviceEndpoints": [],
    "type": "Microsoft.Network/virtualNetworks/subnets"
  },
  {
  ...
  }
]

I attempt to query the ip_configurations details using Steampipe. The column should have the details of "ipConfigurations" but here is the result of the query :

> SELECT ip_configurations FROM azure_subnet WHERE name = 'AzureFirewallSubnet'
+-------------------+
| ip_configurations |
+-------------------+
| <null>            |
+-------------------+ 

The same happen for every subnet except those containing NICs.
The get API response contains a property called "ipConfigurations" which isn't null so the issue may be related to how the Steampipe Azure plugin retrieves and displays the ipConfigurations details.

@ParthaI
Copy link
Contributor

ParthaI commented Aug 13, 2024

Thanks for the detailed information! I will take a look.

@ParthaI
Copy link
Contributor

ParthaI commented Aug 20, 2024

Hello @marcbrlcln,

I apologize for the delay in addressing this issue. I’ve raised a PR to resolve it, and I'm now getting the expected results.

Here’s a snapshot of the connected devices with my subnet:

Screenshot 2024-08-20 at 12 13 13 PM

Query result:

> select name, jsonb_pretty(ip_configurations) from azure_subnet where name = 'turbottest38108'
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name            | jsonb_pretty                                                                                                                                                                                       |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| turbottest38108 | [                                                                                                                                                                                                  |
|                 |     {                                                                                                                                                                                              |
|                 |         "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest38108/providers/Microsoft.Network/loadBalancers/test53/frontendIPConfigurations/test53",               |
|                 |         "name": "test53",                                                                                                                                                                          |
|                 |         "type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",                                                                                                                        |
|                 |         "properties": {                                                                                                                                                                            |
|                 |             "subnet": {                                                                                                                                                                            |
|                 |                 "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest38108/providers/Microsoft.Network/virtualNetworks/turbottest38108/subnets/turbottest38108"     |
|                 |             },                                                                                                                                                                                     |
|                 |             "privateIPAddress": "10.0.2.5",                                                                                                                                                        |
|                 |             "provisioningState": "Succeeded",                                                                                                                                                      |
|                 |             "privateIPAddressVersion": "IPv4",                                                                                                                                                     |
|                 |             "privateIPAllocationMethod": "Dynamic"                                                                                                                                                 |
|                 |         }                                                                                                                                                                                          |
|                 |     },                                                                                                                                                                                             |
|                 |     {                                                                                                                                                                                              |
|                 |         "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest38108/providers/Microsoft.Network/networkInterfaces/turbottest38108/ipConfigurations/turbottest38108", |
|                 |         "name": "turbottest38108",                                                                                                                                                                 |
|                 |         "type": "Microsoft.Network/networkInterfaces/ipConfigurations",                                                                                                                            |
|                 |         "properties": {                                                                                                                                                                            |
|                 |             "subnet": {                                                                                                                                                                            |
|                 |                 "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest38108/providers/Microsoft.Network/virtualNetworks/turbottest38108/subnets/turbottest38108"     |
|                 |             },                                                                                                                                                                                     |
|                 |             "primary": true,                                                                                                                                                                       |
|                 |             "privateIPAddress": "10.0.2.4",                                                                                                                                                        |
|                 |             "provisioningState": "Succeeded",                                                                                                                                                      |
|                 |             "privateIPAddressVersion": "IPv4",                                                                                                                                                     |
|                 |             "privateIPAllocationMethod": "Dynamic"                                                                                                                                                 |
|                 |         }                                                                                                                                                                                          |
|                 |     }                                                                                                                                                                                              |
|                 | ]                                                                                                                                                                                                  |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Please let us know if you need any further assistance.

Thank you!

@marcbrlcln
Copy link
Author

Thank you for your help !

misraved pushed a commit that referenced this issue Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants