diff --git a/docs/docs/segment-az.md b/docs/docs/segment-az.md index 32038411..136fb7a2 100644 --- a/docs/docs/segment-az.md +++ b/docs/docs/segment-az.md @@ -42,14 +42,15 @@ Display the currently active Azure subscription information. ### Properties -- `.EnvironmentName`: `string` - the account environment name -- `.HomeTenantID`: `string` - the home tenant id -- `.ID`: `string` - the account/subscription id +- `.EnvironmentName`: `string` - account environment name +- `.HomeTenantID`: `string` - home tenant id +- `.ID`: `string` - account/subscription id - `.IsDefault`: `boolean` - is the default account or not -- `.Name`: `string` - the account name -- `.State`: `string` - the account state -- `.TenantID`: `string` - the tenant id -- `.User.Name`: `string` - the user name +- `.Name`: `string` - account name +- `.State`: `string` - account state +- `.TenantID`: `string` - tenant id +- `.User.Name`: `string` - user name +- `.User.Type`: `string` - user type - `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH` [templates]: /docs/config-templates diff --git a/src/segments/az.go b/src/segments/az.go index e784fc10..bb4657e5 100644 --- a/src/segments/az.go +++ b/src/segments/az.go @@ -43,6 +43,7 @@ type AzureSubscription struct { type AzureUser struct { Name string `json:"name"` + Type string `json:"type"` } type AzurePowerShellConfig struct { @@ -166,6 +167,7 @@ func (a *Az) getModuleSubscription() bool { a.State = defaultContext.Subscription.State a.User = &AzureUser{ Name: defaultContext.Subscription.ExtendedProperties.Account, + Type: defaultContext.Account.Type, } a.Origin = "PWSH" return true diff --git a/src/segments/az_test.go b/src/segments/az_test.go index f5e8553c..5e90848d 100644 --- a/src/segments/az_test.go +++ b/src/segments/az_test.go @@ -97,6 +97,14 @@ func TestAzSegment(t *testing.T) { Template: "{{ .EnvironmentName }}", Source: pwsh, }, + { + Case: "Az CLI account type", + ExpectedEnabled: true, + ExpectedString: "user", + Template: "{{ .User.Type }}", + HasCLI: true, + Source: cli, + }, } for _, tc := range cases { diff --git a/src/test/AzureRmContext.json b/src/test/AzureRmContext.json index 4bf247de..bc1c77fa 100644 --- a/src/test/AzureRmContext.json +++ b/src/test/AzureRmContext.json @@ -5,7 +5,7 @@ "My Azure Subscription (subscription_id) - tenant_id - user_name": { "Account": { "Id": "232-232-232-232", - "Type": "User", + "Type": "user", "TenantMap": {}, "ExtendedProperties": { "Subscriptions": "subscription_ids",