Skip to content

PyARCrbac is a Python library that provides functions for retrieving tokens from a local metadata service. It can be used to obtain access tokens for Azure resources.

License

Notifications You must be signed in to change notification settings

ikbendion/PyARCrbac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyARCrbac PyPI - Downloads PyPI - Version

PyARCrbac is a Python library that provides functions for retrieving tokens from azure arc-enabled servers using the local metadata service. It can be used to obtain access tokens for Azure resources.

Installation

pip3 install pyarcrbac

Usage

Make sure you have the necessary permissions and environment variables set up to access the azure metadata service.

Graph Tokens

Here's an example of how to use PyARCrbac to retrieve an graph access token:

from pyarcrbac import pyrbac
import requests

def fetch_device_data():
  url = "https://graph.microsoft.com/v1.0/devices"
  headers = {"Authorization": f"Bearer {pyrbac.graph_token()}"}
  response = requests.get(url, headers=headers)
  return response.json()

Azure Management Tokens

Here's an example of how to use PyARCrbac to retrieve an management access token:

from pyarcrbac import pyrbac
import requests

def fetch_device_data():
  url = "https://management.azure.com/subscriptions"
  headers = {"Authorization": f"Bearer {pyrbac.mgmt_token()}"}
  response = requests.get(url, headers=headers)
  return response.json()

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Contact

For any questions or inquiries, please open an issue.

Disclaimer

I am not responsible for any damage and/or misuse as a result of using this lib.

About

PyARCrbac is a Python library that provides functions for retrieving tokens from a local metadata service. It can be used to obtain access tokens for Azure resources.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages