Skip to main content

B2ACCESS account (de)provisioning tool

Project description

A Python tool for handling the (de)provisioning of B2ACCESS user accounts.

The b2accessdeprovisioning tool can be used to retrieve the list of permanently disabled B2ACCESS user accounts via Unity’s Administration API. For each of the disabled accounts, the tool performs the following operations:

  1. immediate removal of assigned attributes (excluding user identifiers)

  2. scheduled removal of all account information after a given period of time

Finally, the tool sends a notification to one or more recipients containing the list of deprovisioned accounts.


  • B2ACCESS integration via Unity’s Administration API v1

  • Attribute whitelisting to indicate information that should be saved when removing account data; otherwise the tool removes all attributes assigned to permanently disabled B2ACCESS user accounts

  • Adjustable duration of time for which the records of deprovisioned users should be maintained

  • Email notifications via SMTP containing deprovisioned account information in json format

Python version

Python 2.6 or 2.7 are fully supported.


To install the tool, simply run:

$ pip install b2accessdeprovisioning

Third party libraries and dependencies

The following libraries will be installed when you install the client library:


Tool settings are adjustable via the config.yml configuration file.

Example config.yml

# B2ACCESS API endpoint connection details
  base_url: <s>""</s>
  path: <s>"rest-admin"</s>
  version: <s>"v1"</s>
  user: <s>"unity_user"</s>
  password: <s>"unity_password"</s>
  cert_verify: True

# List of attributes that should be saved when removing user information.
# Attributes not listed here will be immediately removed upon user
# deprovisioning.
attr_whitelist: []

# Duration of time for which the records of deprovisioned users should be
# maintained (in days). After that period all information about the
# deprovisioned users will be permanently removed.
retention_period: 365

# Notification settings
    # SMTP host to connect to. Defaults to the local host if empty.
    host: <s>""</s>
    # SMTP port to connect to. Defaults to the standard SMTP port (25) if empty.
    port: 587
    # Whether to put the SMTP connection in TLS. Defaults to False.
    use_tls: True
    # Login username/password if the SMTP server requires authentication;
    # otherwise empty.
    user: <s>"smtp_user"</s>
    password: <s>"smtp_password"</s>
    # Sender address
    from: <s>"B2ACCESS</s> <s>Notifications</s> <s><>"</s>
    # List of recipient addresses
      - <s>"SP1</s> <s>Operator</s> <s><>"</s>
      - <s>"SP2</s> <s>Operator</s> <s><>"</s>
    subject: <s>"Deprovisioned</s> <s>B2ACCESS</s> <s>accounts"</s>
    intro_text: <s>"See</s> <s>attachment</s> <s>for</s> <s>details</s> <s>of</s> <s>deprovisioned</s> <s>B2ACCESS</s> <s>accounts.\n\nNote:</s> <s>This</s> <s>is</s> <s>an</s> <s>automated</s> <s>email,</s> <s>please</s> <s>don't</s> <s>reply."</s>

See also config.yml.example.


Simply run the b2accessdeprovisioning.monitor module:

$ python -m b2accessdeprovisioning.monitor

Note: The tool will look for the config.yml configuration file in the current directory.

Example notification

Information about the deprovisioned user accounts is sent via an email attachment in json format (users.json):

        "id": "3f3d5b40-26ce-45db-808a-a5ca3a4e7515"
        "id": "663a5b04-62ec-9d3b-078b-5ac3a4ae5733"


Documentation is available at


Licensed under the Apache 2.0 license, for details see LICENSE.

Project details

Download files

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

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page