Skip to content
Merged
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
30 changes: 28 additions & 2 deletions cmd/ilm-tier-edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ var adminTierEditFlags = []cli.Flag{
Value: "",
Usage: "Azure Blob Storage account key",
},
cli.StringFlag{
Name: "az-sp-tenant-id",
Value: "",
Usage: "Directory ID for the Azure service principal account",
},
cli.StringFlag{
Name: "az-sp-client-id",
Value: "",
Usage: "The client ID of the Azure service principal account",
},
cli.StringFlag{
Name: "az-sp-client-secret",
Value: "",
Usage: "The client secret of the Azure service principal account",
},
cli.StringFlag{
Name: "credentials-file",
Value: "",
Expand Down Expand Up @@ -114,18 +129,29 @@ func mainAdminTierEdit(ctx *cli.Context) error {
var creds madmin.TierCreds
accessKey := ctx.String("access-key")
secretKey := ctx.String("secret-key")
accountKey := ctx.String("account-key")
credsPath := ctx.String("credentials-file")
useAwsRole := ctx.IsSet("use-aws-role")

// Azure, either account-key or one of the 3 service principal flags are required
accountKey := ctx.String("account-key")
azSPTenantID := ctx.String("az-sp-tenant-id")
azSPClientID := ctx.String("az-sp-client-id")
azSPClientSecret := ctx.String("az-sp-client-secret")

switch {
case accessKey != "" && secretKey != "" && !useAwsRole: // S3 tier
creds.AccessKey = accessKey
creds.SecretKey = secretKey
case useAwsRole:
creds.AWSRole = true
case accountKey != "": // Azure tier
case accountKey != "": // Azure tier, account key given
creds.SecretKey = accountKey
case azSPTenantID != "" || azSPClientID != "" || azSPClientSecret != "": // Azure tier, SP creds given
creds.AzSP = madmin.ServicePrincipalAuth{
TenantID: azSPTenantID,
ClientID: azSPClientID,
ClientSecret: azSPClientSecret,
}
case credsPath != "": // GCS tier
credsBytes, e := os.ReadFile(credsPath)
fatalIf(probe.NewError(e), "Unable to read credentials file at %s", credsPath)
Expand Down