turbot / steampipe-plugin-azure

Use SQL to instantly query Azure resources across regions and subscriptions. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/azure
Apache License 2.0
37 stars 17 forks source link

Add table `azure_backup_policy` + items #723

Closed Shr3ps closed 5 months ago

Shr3ps commented 8 months ago

References I found this in SDK: https://github.com/Azure/azure-sdk-for-go/blob/v58.0.0/services/recoveryservices/mgmt/2021-01-01/backup/models.go And the associated Terraform data resource: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/backup_policy_vm

We would like to be able to query all backup policies available in Azure: vm backup, file share, containers, etc. and also be able to list all backup items attached to policies (vm item list attached to a backup VM policy, etc.)

I don't know if it's best to have a dedicated table for items or have a jsonb attribute in the policy table.

ParthaI commented 7 months ago

Hello, @Shr3ps, thanks for highlighting the issue.

Upon reviewing, I found that we are utilizing Azure GO SDK version v58.0.0+incompatible, which unfortunately lacks API support for listing all Backup policies in Azure Recovery Service. Could you specify which details you require from this model? This will help us to design the table to meet our needs effectively.

Thank you!

Shr3ps commented 7 months ago

Hi @ParthaI

I think would be great to have these struct equivalent in Steampipe:

type AzureFileShareProtectableItem struct {
AzureFileshareProtectedItem 

AzureIaaSClassicComputeVMProtectedItem 
AzureIaaSComputeVMProtectedItem

so we can have items attached to a recovery vault (and we can wait a bit later for Policies)

ParthaI commented 7 months ago

Thank you, @Shr3ps, for the information. I'll attempt it again and inform you if I encounter any further blockers.

bigdatasourav commented 6 months ago

Sample block which can be useful -

"github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-01-01/backup"

ParentHydrate = listRecoveryServicesVaults

backupPoliciesClient := backup.NewPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID)
backupPoliciesClient.List(ctx,vaultName,resourceGroupName,"")