Table of Contents
This started out as a project to help teach myself the Go programming language and ended up being a somewhat useful utility. The main purpose of the tool is to help speed up your day-to-day admin workflow. Manually clicking PIM activation links in the Azure portal is time consuming and frustrating. This tool allows you to concurrently submit multiple activations and monitor the progress along the way.
Currently the tool only supports activating Azure Subscription access roles. More types of target resources and activations coming soon.
Currently supported on Linux, OSX and Windows.
- Go (optional for running/building from source)
From the release builds, simply download the appropriate binary for your platform.
You can run as is or rename for your platform so the name isn't so long.
Windows
move gopim-windows-amd64.exe pim.exe
Linux
mv gopim-linux-amd64 pim && chmod 755 pim
OSX
mv gopim-darwin-amd64 pim && chmod 755 pim
You can also just run directly from a clone of this repo if you have golang installed.
Usage of pim:
-debug
Debug mode
-dryrun
Dry run mode, do not activate PIM
-nocache
Do not use cached authentication record
-subs string
Comma separated subscription names for PIM activation (required)
-tenant string
Azure Tenant ID
-v short alias for -version
-version
print version information and exit
pim
will read config from either the current directory or from the following directories depending on your platform:
- Linux:
$HOME/.config/gopim
- Windows:
%AppData%\gopim
- OSX:
$HOME/Library/Application Support/gopim
Note: You need to specify your Azure Tenant ID either in the pim.toml
config file or as an argument.
Use the pim.toml.example
file as a template. Make sure to double-quote values as certain strings may be parsed incorrectly without them.
tenant = "681648d6-6955-45b6-a2d2-5fcfd92aedf4"
To run, simply use go run
, just provide a list of subscriptions to activate using PIM.
go run . -subs 'Learning Subscription,Other Subscription'
Run from the local directory
./pim -subs 'Learning Subscription,Other Subscription'
Or copy the executable to a location in your path such as /usr/local/bin
and reference pim
from anywhere
sudo cp pim /usr/local/bin/ && sudo chmod 775 /usr/local/bin/pim
Now run without specifying path...
pim -subs 'Learning Subscription,Other Subscription'
Pim runs on OSX very similarly to Linux. However, due to Apple app signing restrictions, you'll likely get an error like this when running for the first time:
"gopim-darwin-amd64" cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware
Since I'm too cheap to fork out $99/yr for an Apple developer license, there's an extra step you'll need to do here.
xattr -d com.apple.quarantine pim
You can now run normally:
./pim -subs 'Learning Subscription,Other Subscription'
pim.exe -subs 'Learning Subscription,Other Subscription'
If successful, you should see some output like the following:
10:28AM INF Already logged in to Azure. Skipping login step.
10:28AM INF Successfully retrieved roleEligibilityScheduleInstances
10:28AM INF Role found id=/subscriptions/00000000-0000-0000-0000-000000000000 subscription="Learning Subscription"
10:28AM INF Found roleEligibilityScheduleInstance subscription="Learning Subscription"
10:28AM INF Activating PIM displayName="Learning Subscription"
10:28AM INF Successfully activated PIM
Go has a lovely cross compilation toolchain and is very easy to use. To build binaries for Windows (32/64bit), Linux (64bit) and OSX (64bit), use the build.sh
script. If there is a need, I can create a Windows compatible build script as well.
Simply provide the project url as the build script arg:
./build.sh github.com/sanelson/gopim
If you want to just build for your current platform without the build script, run:
go build -o pim
- Support PIM Group activations
- Remove dependency on az cli
- Set up automated github builds
- Support Windows & OSX
- Support Windows
- Support and test OSX
- Create TUI for interactive use
- Create winget compatible installer
- Create Linux install script
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT license. See LICENSE.txt
for more information.
Sam Nelson - [email protected] Project Link: https://github.com/sanelson/gopim