-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtenant.go
More file actions
33 lines (29 loc) · 964 Bytes
/
tenant.go
File metadata and controls
33 lines (29 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cmd
import (
"github.com/Method-Security/methodazure/internal/tenant"
"github.com/spf13/cobra"
)
// InitTenantCommand initializes the `methodazure tenant` subcommand that deals with enumerating Azure Tenant related details.
func (a *MethodAzure) InitTenantCommand() {
tenantCmd := &cobra.Command{
Use: "tenant",
Short: "Audit and command Azure Tenants",
Long: `Audit and command Azure Tenants`,
}
enumerateCmd := &cobra.Command{
Use: "enumerate",
Short: "Enumerate Tenants for the provided credentials",
Long: `Enumerate Tenants for the provided credentials`,
Run: func(cmd *cobra.Command, args []string) {
report, err := tenant.EnumerateTenants(cmd.Context(), a.AzureConfig)
if err != nil {
errorMessage := err.Error()
a.OutputSignal.ErrorMessage = &errorMessage
a.OutputSignal.Status = 1
}
a.OutputSignal.Content = report
},
}
tenantCmd.AddCommand(enumerateCmd)
a.RootCmd.AddCommand(tenantCmd)
}