Simple library to get current Azure info like subscription_id, tenant_id, group, and location.
Add this line to your application's Gemfile:
gem 'azure_info'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install azure_info
AzureInfo.group
AzureInfo.location
AzureInfo.subscription_id
AzureInfo.tenant_id
This tool calls out to the az CLI. So the az CLI is required.
This library will return values using different sources with this precedence:
- Environment variables: ARM_GROUP, ARM_LOCATION, ARM_SUBSCRIPTION_ID, ARM_TENANT_ID
- az cli: Usually configured in the
~/.azure/config
. Useaz configure --list-defaults
to double check. - Defaults: A default is set for
location=eastus
. The other values must be configured.
The config file used by the az
command looks something like this:
~/.azure/config
[cloud]
name = AzureCloud
[defaults]
location = eastus
This command is also useful:
az account show
az login --username EMAIL_ADDRESS -t TENANT_ID
az account set --subscription SUBSCRIPTION_ID
az configure --defaults location=eastus group=RESOURCE_GROUP
Bug reports and pull requests are welcome on GitHub at https://github.com/boltops-tools/azure_info.