Environment variable | Description |
---|---|
AZURE_AUTHORITY_HOST |
The Microsoft Entra ID endpoint (https://login.microsoftonline.com/). |
AZURE_CLIENT_ID |
The client ID of the Microsoft Entra ID registered application or user-assigned managed identity. |
AZURE_TENANT_ID |
The tenant ID of the Microsoft Entra ID registered application or user-assigned managed identity. |
AZURE_FEDERATED_TOKEN_FILE |
The path of the projected service account token file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Variables | |
SUBSCRIPTION_ID=$(az account show --query id --output tsv) # Subscription ID | |
ROLE_NAME="8e3af657-a8ff-443c-a75c-2fe8c4bcb635" # Owner role | |
ROLE_DEFINITION_ID="/subscriptions/${SUBSCRIPTION_ID}/providers/Microsoft.Authorization/roleDefinitions/${ROLE_NAME}" # Role definition resource ID | |
PRINCIPAL_ID=$(az ad user show --id $(az account show --query user.name -o tsv) --query id -o tsv) # Your account object ID | |
ROLE_ASSIGNMENT_ID=$(uuidgen) # Generate a unique GUID for the role assignment | |
JUSTIFICATION="I need access to [$(az account show --query name --output tsv)] Azure subscription" # Justification for the role assignment | |
API_VERSION="2020-10-01" # API version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
MIT License | |
Copyright (c) 2023 Paolo Salvatori | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |