Skip to content

Commit

Permalink
skip disabled or deleted subscriptions #157
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Oct 15, 2023
1 parent 4387e68 commit 2bad783
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/azqr/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"sync"
"time"

"github.com/Azure/azqr/internal/ref"
"github.com/Azure/azqr/internal/scanners"
"github.com/Azure/azqr/internal/scanners/adf"
"github.com/Azure/azqr/internal/scanners/afd"
Expand Down Expand Up @@ -424,7 +425,13 @@ func listSubscriptions(ctx context.Context, cred azcore.TokenCredential, options
if err != nil {
return nil, err
}
subscriptions = append(subscriptions, pageResp.Value...)

for _, s := range pageResp.Value {
if s.State != ref.Of(armsubscription.SubscriptionStateDisabled) &&
s.State != ref.Of(armsubscription.SubscriptionStateDeleted) {
subscriptions = append(subscriptions, s)
}
}
}
return subscriptions, nil
}
Expand Down

0 comments on commit 2bad783

Please sign in to comment.