oh-my-posh/website/docs/segments/az.mdx
Jan De Dobbeleer 56ae9e6fda feat(az): parse pwsh context from module output
this fixes an issue where using multiple powershell sessions with a
different Azure context would display the same context everywhere when
using Set-AzContext to switch between them

BREAKING CHANGE: this requires adding `$env:POSH_AZURE_ENABLED = $true`
to your PowerShell profile if you want to get the correct context
displayed in your prompt for Azure powershell
2022-09-26 08:23:03 +02:00

62 lines
2.7 KiB
Plaintext

---
id: az
title: Azure Subscription
sidebar_label: Azure
---
## What
Display the currently active Azure subscription information.
:::tip
PowerShell offers support for the [az][az] module, but it is disabled by default.
To enable this, set `$env:POSH_AZURE_ENABLED = $true` in your `$PROFILE` after
initializing Oh My Posh.
:::
## Sample Configuration
```json
{
"type": "az",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#000000",
"background": "#9ec3f0",
"template": " \uFD03 {{ .EnvironmentName }}"
}
```
## Properties
| Name | Type | Description |
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `source` | `string` | <ul><li>`first_match`: try the CLI config first, then the PowerShell module. The first to resolve is displayed (**default**)</li><li>`cli`: fetch the information from the CLI config</li><li>`pwsh`: fetch the information from the PowerShell Module config</li></ul> |
## Template ([info][templates])
:::note default template
```template
{{ .Name }}
```
:::
### Properties
| Name | Type | Description |
| ------------------ | --------- | -------------------------------------------------------------- |
| `.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` | 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/configuration/templates