From 6c0f51ead024aa68e81d2a0e8ada98f48a87bca7 Mon Sep 17 00:00:00 2001 From: Irshad Ahmed Date: Fri, 20 Oct 2023 10:21:53 -0500 Subject: [PATCH] log missing azure tenant ids during analysis --- cmd/api/src/daemons/datapipe/agi.go | 7 +++++++ cmd/api/src/daemons/datapipe/analysis.go | 18 +++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmd/api/src/daemons/datapipe/agi.go b/cmd/api/src/daemons/datapipe/agi.go index 40fda538a0..387b801a38 100644 --- a/cmd/api/src/daemons/datapipe/agi.go +++ b/cmd/api/src/daemons/datapipe/agi.go @@ -69,6 +69,13 @@ func ParallelTagAzureTierZero(ctx context.Context, db graph.Database) error { readerWG = &sync.WaitGroup{} ) + // log missing tenant IDs for easier debugging + for _, tenant := range tenants { + if _, err = tenant.Properties.Get(azure.TenantID.String()).String(); err != nil { + log.Errorf("Error getting tenant id for tenant %d: %v", tenant.ID, err) + } + } + readerWG.Add(1) go func() { diff --git a/cmd/api/src/daemons/datapipe/analysis.go b/cmd/api/src/daemons/datapipe/analysis.go index 9d6ec7d2a9..5a3a32ab25 100644 --- a/cmd/api/src/daemons/datapipe/analysis.go +++ b/cmd/api/src/daemons/datapipe/analysis.go @@ -1,17 +1,17 @@ // Copyright 2023 Specter Ops, Inc. -// +// // Licensed under the Apache License, Version 2.0 // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// +// // SPDX-License-Identifier: Apache-2.0 package datapipe @@ -20,19 +20,19 @@ import ( "context" "fmt" + "github.com/specterops/bloodhound/analysis" + adAnalysis "github.com/specterops/bloodhound/analysis/ad" + "github.com/specterops/bloodhound/dawgs/graph" + "github.com/specterops/bloodhound/errors" "github.com/specterops/bloodhound/src/analysis/ad" "github.com/specterops/bloodhound/src/analysis/azure" "github.com/specterops/bloodhound/src/config" "github.com/specterops/bloodhound/src/database" "github.com/specterops/bloodhound/src/services/agi" "github.com/specterops/bloodhound/src/services/dataquality" - "github.com/specterops/bloodhound/analysis" - adAnalysis "github.com/specterops/bloodhound/analysis/ad" - "github.com/specterops/bloodhound/dawgs/graph" - "github.com/specterops/bloodhound/errors" ) -func RunAnalysisOperations(ctx context.Context, db database.Database, graphDB graph.Database, cfg config.Configuration) error { +func RunAnalysisOperations(ctx context.Context, db database.Database, graphDB graph.Database, _ config.Configuration) error { var ( collector = &errors.ErrorCollector{} )