azure-developer-devcenter


Nameazure-developer-devcenter JSON
Version 1.0.0b2 PyPI version JSON
download
home_pagehttps://github.com/Azure/azure-sdk-for-python/tree/main/sdk
SummaryMicrosoft Azure Developer DevCenter Service Client Library for Python
upload_time2023-02-08 23:56:14
maintainer
docs_urlNone
authorMicrosoft Corporation
requires_python>=3.7
licenseMIT License
keywords azure azure sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Azure DevCenter Service client library for Python
The Azure DevCenter package provides access to manage resources for Microsoft Dev Box and Azure Deployment Environments. This SDK enables managing developer machines and environments in Azure.

Use the package for Azure DevCenter to:
> Create, access, manage, and delete Dev Box resources
> Create, deploy, manage, and delete Environment resources

## Getting started

### Installating the package

```bash
python -m pip install azure-developer-devcenter
```

#### Prequisites

- Python 3.7 or later is required to use this package.
- You need an [Azure subscription][azure_sub] to use this package.
- You must have [configured](https://learn.microsoft.com/azure/dev-box/quickstart-configure-dev-box-service) a DevCenter, Project, Network Connection, Dev Box Definition, and Pool before you can create Dev Boxes 
- You must have [configured](https://learn.microsoft.com/azure/deployment-environments/) a DevCenter, Project, Catalog, and Environment Type before you can create Environments

#### Create with an Azure Active Directory Credential
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
provide an instance of the desired credential type obtained from the
[azure-identity][azure_identity_credentials] library.

To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip]

After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`

Use the returned token credential to authenticate the client:

```python
>>> import os
>>> from azure.developer.devcenter import DevCenterClient
>>> from azure.identity import DefaultAzureCredential
>>> tenant_id = os.environ['AZURE_TENANT_ID']
>>> client = DevCenterClient(tenant_id=tenant_id, dev_center="my_dev_center", credential=DefaultAzureCredential())
```

## Examples

### Dev Box Management
```python
>>> import os
>>> from azure.developer.devcenter import DevCenterClient
>>> from azure.identity import DefaultAzureCredential
>>> from azure.core.exceptions import HttpResponseError
>>> tenant_id = os.environ['AZURE_TENANT_ID']
>>> client = DevCenterClient(tenant_id=tenant_id, dev_center="my_dev_center", credential=DefaultAzureCredential())
>>> try:
        # Fetch control plane resource dependencies
        projects = list(client.dev_center.list_projects(top=1))
        target_project_name = projects[0]['name']

        pools = list(client.dev_boxes.list_pools(target_project_name, top=1))
        target_pool_name = pools[0]['name']

        # Stand up a new dev box
        create_response = client.dev_boxes.begin_create_dev_box(target_project_name, "Test_DevBox", {"poolName": target_pool_name})
        devbox_result = create_response.result()

        LOG.info(f"Provisioned dev box with status {devbox_result['provisioningState']}.")

        # Connect to the provisioned dev box
        remote_connection_response = client.dev_boxes.get_remote_connection(target_project_name, "Test_DevBox")
        LOG.info(f"Connect to the dev box using web URL {remote_connection_response['webUrl']}")

        # Tear down the dev box when finished
        delete_response = client.dev_boxes.begin_delete_dev_box(target_project_name, "Test_DevBox")
        delete_response.wait()
        LOG.info("Deleted dev box successfully.")
    except HttpResponseError as e:
        print('service responds error: {}'.format(e.response.json()))

```

### Environment Management
```python
>>> import os
>>> from azure.developer.devcenter import DevCenterClient
>>> from azure.identity import DefaultAzureCredential
>>> from azure.core.exceptions import HttpResponseError
>>> tenant_id = os.environ['AZURE_TENANT_ID']
>>> client = DevCenterClient(tenant_id=tenant_id, dev_center="my_dev_center", credential=DefaultAzureCredential())
>>> try:
        # Fetch control plane resource dependencies
        target_project_name = list(client.dev_center.list_projects(top=1))[0]['name']
        target_catalog_item_name = list(client.environments.list_catalog_items(target_project_name, top=1))[0]['name']
        target_environment_type_name = list(client.environments.list_environment_types(target_project_name, top=1))[0]['name']

        # Stand up a new environment
        create_response = client.environments.begin_create_environment(target_project_name,
                                                           "Dev_Environment",
                                                           {"catalogItemName": target_catalog_item_name, "environmentType": target_environment_type_name})
        environment_result = create_response.result()

        LOG.info(f"Provisioned environment with status {environment_result['provisioningState']}.")

        # Fetch deployment artifacts
        artifact_response = client.environments.list_artifacts_by_environment(target_project_name, "Dev_Environment")

        for artifact in artifact_response:
            LOG.info(artifact)

        # Tear down the environment when finished
        delete_response = client.environments.begin_delete_environment(target_project_name, "Dev_Environment")
        delete_response.wait()
        LOG.info("Completed deletion for the environment.")
    except HttpResponseError as e:
        print('service responds error: {}'.format(e.response.json()))

```
## Key concepts
Dev Boxes refer to managed developer machines running in Azure. Dev Boxes are provisioned in Pools, which define the network and image used for a Dev Box.

Environments refer to templated developer environments, which combine a template (Catalog Item) and parameters.

## Troubleshooting
Errors can occur during initial requests and long-running operations, and will provide information about how to resolve the error. 
Be sure to confirm that dependent resources, such as pools and catalogs, are set up properly and are in a healthy state. You will not be able to create resources with the package when your dependent resources are in a failed state.

## Next steps
Get started by exploring our samples and starting to use the package!

## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
additional questions or comments.

<!-- LINKS -->
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
[azure_identity_pip]: https://pypi.org/project/azure-identity/
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
[pip]: https://pypi.org/project/pip/
[azure_sub]: https://azure.microsoft.com/free/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk",
    "name": "azure-developer-devcenter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "azure,azure sdk",
    "author": "Microsoft Corporation",
    "author_email": "azpysdkhelp@microsoft.com",
    "download_url": "https://files.pythonhosted.org/packages/ed/0c/513babf216500e9ab60de7e9cc58ef16fe9cdb2693521e2f7c4e0f3d4e24/azure-developer-devcenter-1.0.0b2.zip",
    "platform": null,
    "description": "\n# Azure DevCenter Service client library for Python\nThe Azure DevCenter package provides access to manage resources for Microsoft Dev Box and Azure Deployment Environments. This SDK enables managing developer machines and environments in Azure.\n\nUse the package for Azure DevCenter to:\n> Create, access, manage, and delete Dev Box resources\n> Create, deploy, manage, and delete Environment resources\n\n## Getting started\n\n### Installating the package\n\n```bash\npython -m pip install azure-developer-devcenter\n```\n\n#### Prequisites\n\n- Python 3.7 or later is required to use this package.\n- You need an [Azure subscription][azure_sub] to use this package.\n- You must have [configured](https://learn.microsoft.com/azure/dev-box/quickstart-configure-dev-box-service) a DevCenter, Project, Network Connection, Dev Box Definition, and Pool before you can create Dev Boxes \n- You must have [configured](https://learn.microsoft.com/azure/deployment-environments/) a DevCenter, Project, Catalog, and Environment Type before you can create Environments\n\n#### Create with an Azure Active Directory Credential\nTo use an [Azure Active Directory (AAD) token credential][authenticate_with_token],\nprovide an instance of the desired credential type obtained from the\n[azure-identity][azure_identity_credentials] library.\n\nTo authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip]\n\nAfter setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.\nAs an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client:\n\nSet the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:\n`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`\n\nUse the returned token credential to authenticate the client:\n\n```python\n>>> import os\n>>> from azure.developer.devcenter import DevCenterClient\n>>> from azure.identity import DefaultAzureCredential\n>>> tenant_id = os.environ['AZURE_TENANT_ID']\n>>> client = DevCenterClient(tenant_id=tenant_id, dev_center=\"my_dev_center\", credential=DefaultAzureCredential())\n```\n\n## Examples\n\n### Dev Box Management\n```python\n>>> import os\n>>> from azure.developer.devcenter import DevCenterClient\n>>> from azure.identity import DefaultAzureCredential\n>>> from azure.core.exceptions import HttpResponseError\n>>> tenant_id = os.environ['AZURE_TENANT_ID']\n>>> client = DevCenterClient(tenant_id=tenant_id, dev_center=\"my_dev_center\", credential=DefaultAzureCredential())\n>>> try:\n        # Fetch control plane resource dependencies\n        projects = list(client.dev_center.list_projects(top=1))\n        target_project_name = projects[0]['name']\n\n        pools = list(client.dev_boxes.list_pools(target_project_name, top=1))\n        target_pool_name = pools[0]['name']\n\n        # Stand up a new dev box\n        create_response = client.dev_boxes.begin_create_dev_box(target_project_name, \"Test_DevBox\", {\"poolName\": target_pool_name})\n        devbox_result = create_response.result()\n\n        LOG.info(f\"Provisioned dev box with status {devbox_result['provisioningState']}.\")\n\n        # Connect to the provisioned dev box\n        remote_connection_response = client.dev_boxes.get_remote_connection(target_project_name, \"Test_DevBox\")\n        LOG.info(f\"Connect to the dev box using web URL {remote_connection_response['webUrl']}\")\n\n        # Tear down the dev box when finished\n        delete_response = client.dev_boxes.begin_delete_dev_box(target_project_name, \"Test_DevBox\")\n        delete_response.wait()\n        LOG.info(\"Deleted dev box successfully.\")\n    except HttpResponseError as e:\n        print('service responds error: {}'.format(e.response.json()))\n\n```\n\n### Environment Management\n```python\n>>> import os\n>>> from azure.developer.devcenter import DevCenterClient\n>>> from azure.identity import DefaultAzureCredential\n>>> from azure.core.exceptions import HttpResponseError\n>>> tenant_id = os.environ['AZURE_TENANT_ID']\n>>> client = DevCenterClient(tenant_id=tenant_id, dev_center=\"my_dev_center\", credential=DefaultAzureCredential())\n>>> try:\n        # Fetch control plane resource dependencies\n        target_project_name = list(client.dev_center.list_projects(top=1))[0]['name']\n        target_catalog_item_name = list(client.environments.list_catalog_items(target_project_name, top=1))[0]['name']\n        target_environment_type_name = list(client.environments.list_environment_types(target_project_name, top=1))[0]['name']\n\n        # Stand up a new environment\n        create_response = client.environments.begin_create_environment(target_project_name,\n                                                           \"Dev_Environment\",\n                                                           {\"catalogItemName\": target_catalog_item_name, \"environmentType\": target_environment_type_name})\n        environment_result = create_response.result()\n\n        LOG.info(f\"Provisioned environment with status {environment_result['provisioningState']}.\")\n\n        # Fetch deployment artifacts\n        artifact_response = client.environments.list_artifacts_by_environment(target_project_name, \"Dev_Environment\")\n\n        for artifact in artifact_response:\n            LOG.info(artifact)\n\n        # Tear down the environment when finished\n        delete_response = client.environments.begin_delete_environment(target_project_name, \"Dev_Environment\")\n        delete_response.wait()\n        LOG.info(\"Completed deletion for the environment.\")\n    except HttpResponseError as e:\n        print('service responds error: {}'.format(e.response.json()))\n\n```\n## Key concepts\nDev Boxes refer to managed developer machines running in Azure. Dev Boxes are provisioned in Pools, which define the network and image used for a Dev Box.\n\nEnvironments refer to templated developer environments, which combine a template (Catalog Item) and parameters.\n\n## Troubleshooting\nErrors can occur during initial requests and long-running operations, and will provide information about how to resolve the error. \nBe sure to confirm that dependent resources, such as pools and catalogs, are set up properly and are in a healthy state. You will not be able to create resources with the package when your dependent resources are in a failed state.\n\n## Next steps\nGet started by exploring our samples and starting to use the package!\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require\nyou to agree to a Contributor License Agreement (CLA) declaring that you have\nthe right to, and actually do, grant us the rights to use your contribution.\nFor details, visit https://cla.microsoft.com.\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether\nyou need to provide a CLA and decorate the PR appropriately (e.g., label,\ncomment). Simply follow the instructions provided by the bot. You will only\nneed to do this once across all repos using our CLA.\n\nThis project has adopted the\n[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,\nsee the Code of Conduct FAQ or contact opencode@microsoft.com with any\nadditional questions or comments.\n\n<!-- LINKS -->\n[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/\n[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token\n[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials\n[azure_identity_pip]: https://pypi.org/project/azure-identity/\n[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential\n[pip]: https://pypi.org/project/pip/\n[azure_sub]: https://azure.microsoft.com/free/\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Microsoft Azure Developer DevCenter Service Client Library for Python",
    "version": "1.0.0b2",
    "split_keywords": [
        "azure",
        "azure sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2465ca5cf8e8bdb4f75426061de80d0d096b0e485f2d0e5840738bb145764fc",
                "md5": "c5752d9d27500c291840caaaeca18292",
                "sha256": "8373318401500711782225b509c927358d26b28a529392af68ee284d8586aa36"
            },
            "downloads": -1,
            "filename": "azure_developer_devcenter-1.0.0b2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5752d9d27500c291840caaaeca18292",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 62404,
            "upload_time": "2023-02-08T23:56:11",
            "upload_time_iso_8601": "2023-02-08T23:56:11.569102Z",
            "url": "https://files.pythonhosted.org/packages/a2/46/5ca5cf8e8bdb4f75426061de80d0d096b0e485f2d0e5840738bb145764fc/azure_developer_devcenter-1.0.0b2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed0c513babf216500e9ab60de7e9cc58ef16fe9cdb2693521e2f7c4e0f3d4e24",
                "md5": "5d95dfd85ea1d6e9cde76ff080388573",
                "sha256": "cc57f6b1853e86226039748a5feeb9b3cc652d3b8cc4bc052cf29bb25ca4c3cb"
            },
            "downloads": -1,
            "filename": "azure-developer-devcenter-1.0.0b2.zip",
            "has_sig": false,
            "md5_digest": "5d95dfd85ea1d6e9cde76ff080388573",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 80409,
            "upload_time": "2023-02-08T23:56:14",
            "upload_time_iso_8601": "2023-02-08T23:56:14.024967Z",
            "url": "https://files.pythonhosted.org/packages/ed/0c/513babf216500e9ab60de7e9cc58ef16fe9cdb2693521e2f7c4e0f3d4e24/azure-developer-devcenter-1.0.0b2.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-08 23:56:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "azure-developer-devcenter"
}
        
Elapsed time: 0.04486s