https://github.com/boltops-tools/azure_info
Azure info: Simple library to get current subscription, resource group, and location, etc
https://github.com/boltops-tools/azure_info
Last synced: 11 months ago
JSON representation
Azure info: Simple library to get current subscription, resource group, and location, etc
- Host: GitHub
- URL: https://github.com/boltops-tools/azure_info
- Owner: boltops-tools
- License: apache-2.0
- Created: 2020-06-03T17:45:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-27T22:20:21.000Z (over 4 years ago)
- Last Synced: 2025-06-17T15:55:33.595Z (12 months ago)
- Language: Ruby
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AzureInfo
[](https://badge.fury.io/rb/azure_info)
[](https://www.boltops.com)
Simple library to get current Azure info like subscription_id, tenant_id, group, and location.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'azure_info'
```
And then execute:
$ bundle install
Or install it yourself as:
$ gem install azure_info
## Usage
```ruby
AzureInfo.group
AzureInfo.location
AzureInfo.subscription_id
AzureInfo.tenant_id
```
## Dependencies
This tool calls out to the az CLI. So the az CLI is required.
## Precedence
This library will return values using different sources with this precedence:
1. Environment variables: ARM_GROUP, ARM_LOCATION, ARM_SUBSCRIPTION_ID, ARM_TENANT_ID
2. az cli: Usually configured in the `~/.azure/config`. Use `az configure --list-defaults` to double check.
3. 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
## Setting the Defaults with az cli
az login --username EMAIL_ADDRESS -t TENANT_ID
az account set --subscription SUBSCRIPTION_ID
az configure --defaults location=eastus group=RESOURCE_GROUP
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/boltops-tools/azure_info.