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

Update docs/index.md file to include multi-subscription examples closes #519 #538

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 94 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,96 @@ connection "azure" {
}
```

## Get involved
## Multi-Subscription Connections

- Open source: https://github.com/turbot/steampipe-plugin-azure
- Community: [Slack Channel](https://steampipe.io/community/join)
You may create multiple azure connections:

```hcl
connection "azure_all" {
type = "aggregator"
plugin = "azure"
connections = ["azure_*"]
}

connection "azure_sub_1" {
plugin = "azure"
subscription_id = "azure_01"
}

connection "azure_sub_2" {
plugin = "azure"
subscription_id = "azure_02"
}

connection "azure_sub_3" {
plugin = "azure"
subscription_id = "azure_03"
}
```

Depending on the mode of authentication, a multi-subscription configuration can also look like:

```hcl
connection "azure_all" {
type = "aggregator"
plugin = "azure"
connections = ["azure_*"]
}

connection "azure_sub_1" {
plugin = "azure"
tenant_id = "00000000-0000-0000-0000-000000000000"
subscription_id = "00000000-0000-0000-0000-000000000000"
client_id = "00000000-0000-0000-0000-000000000000"
client_secret = "~dummy@3password"
}

connection "azure_sub_2" {
plugin = "azure"
tenant_id = "00000000-0000-0000-0000-000000000000"
subscription_id = "00000000-0000-0000-0000-000000000000"
client_id = "00000000-0000-0000-0000-000000000000"
client_secret = "~dummy@3password"
}
```

Each connection is implemented as a distinct [Postgres schema](https://www.postgresql.org/docs/current/ddl-schemas.html). As such, you can use qualified table names to query a specific connection:

```sql
select * from azure_sub_1.azure_subscription
```

Alternatively, you can use an unqualified name and it will be resolved according to the [Search Path](https://steampipe.io/docs/using-steampipe/managing-connections#setting-the-search-path):

```sql
select * from azure_subscription
```

You can create multi-subscription connections by using an [**aggregator** connection](https://steampipe.io/docs/using-steampipe/managing-connections#using-aggregators). Aggregators allow you to query data from multiple connections for a plugin as if they are a single connection:

```hcl
connection "azure_all" {
plugin = "azure"
type = "aggregator"
connections = ["azure_sub_1", "azure_sub_2", "azure_sub_3"]
}
```

Querying tables from this connection will return results from the `azure_sub_1`, `azure_sub_2`, and `azure_sub_3` connections:

```sql
select * from azure_all.azure_subscription
```

Steampipe supports the `*` wildcard in the connection names. For example, to aggregate all the Azure plugin connections whose names begin with `azure_`:

```hcl
connection "azure_all" {
type = "aggregator"
plugin = "azure"
connections = ["azure_*"]
}
```

misraved marked this conversation as resolved.
Show resolved Hide resolved
## Configuring Azure Credentials

Expand Down Expand Up @@ -239,3 +325,8 @@ connection "azure" {
plugin = "azure"
}
```

## Get involved

- Open source: https://github.com/turbot/steampipe-plugin-azure
- Community: [Slack Channel](https://steampipe.io/community/join)