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 status_of_primary and status_of_secondary to azure_storage_account table #605

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
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
14 changes: 13 additions & 1 deletion azure/table_azure_storage_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,15 @@ func tableAzureStorageAccount(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Account.AccountProperties.PrimaryEndpoints.Web"),
},
{
Name: "status_of_primary",
Description: "The status indicating whether the primary location of the storage account is available or unavailable. Possible values include: 'available', 'unavailable'.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Account.AccountProperties.StatusOfPrimary"),
},
{
Name: "provisioning_state",
Description: "The provisioning state of the virtual network resource.",
Description: "The provisioning state of the storage account resource.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Account.AccountProperties.ProvisioningState").Transform(transform.ToString),
},
Expand All @@ -342,6 +348,12 @@ func tableAzureStorageAccount(_ context.Context) *plugin.Table {
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Account.AccountProperties.SecondaryLocation"),
},
{
Name: "status_of_secondary",
Description: "The status indicating whether the secondary location of the storage account is available or unavailable. Only available if the SKU name is Standard_GRS or Standard_RAGRS. Possible values include: 'available', 'unavailable'.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Account.AccountProperties.StatusOfSecondary"),
},
{
Name: "diagnostic_settings",
Description: "A list of active diagnostic settings for the storage account.",
Expand Down
18 changes: 17 additions & 1 deletion docs/tables/azure_storage_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,20 @@ select
jsonb_pretty(diagnostic_settings) as diagnostic_settings
from
azure_storage_account;
```
```

### List storage accounts with replication but unavailable secondary

```sql
select
name,
status_of_primary,
status_of_secondary,
sku_name
from
azure_storage_account
where
status_of_primary = 'available'
and status_of_secondary != 'available'
and sku_name in ('Standard_GRS', 'Standard_RAGRS')
```