Skip to main content

A Library that simplifies interaction with Azure / ARC Metadata services.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyARCrbac-1.0.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyARCrbac-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file PyARCrbac-1.0.0.tar.gz.

File metadata

  • Download URL: PyARCrbac-1.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for PyARCrbac-1.0.0.tar.gz
Algorithm Hash digest
SHA256 82661c06e084758f7f7b4d8379386e0bc7474fce0117759a6bc25a6eb5b6c9b3
MD5 9d9272c51c8e69c05d23870e28c9c422
BLAKE2b-256 f60dd42296a4510ebaddeb564f377ffa769f79fb910a14ca38223feaca8ff945

See more details on using hashes here.

File details

Details for the file PyARCrbac-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: PyARCrbac-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for PyARCrbac-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e3bce48083e1e059971b5d2f708e9e71e71f9d11556d7c5d09f4751f28b956b
MD5 644e3755963a50fb4cd86056515b8b0c
BLAKE2b-256 fe1cb04bc0f2f21eca8888857c46be22f8ceadccdd085d32033914bb56929261

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page