Important: Test Base for Microsoft 365 will transition to end-of-life (EOL) on May 31, 2024. We're committed to working closely with Test Base customers to provide support and guidance to make the transition as smooth as possible. If you have any questions or concerns, or need assistance, please submit a support request. |
Automation is a key aspect of DevOps and agile development. Are you looking to manage Test Base for Microsoft 365 resources, get test results programmatically, and integrate them with our CI tools? Test Base has now released both the REST APIs, and Python SDK!
These APIs/SDK enable IT professionals and app developers to:
Below is an example of Test Base account creation by using Python SDK.
Prerequisites:
pip install azure-identity
pip install azure-mgmt-testbase
Check How to authenticate Python applications with Azure services and https://pypi.org/project/azure-identity for other supported authentication methods.
az login
The code snippet below covers the flow of creating a Test Base Account including
Copy the code to your Python development environment, and replace "<subscription-id>" with your Azure subscription ID and “<resource-group-name>” with your Resource Group you created above.
from azure.identity import AzureCliCredential
from azure.mgmt.testbase import TestBase
from azure.mgmt.testbase.models import TestBaseAccountResource
from azure.mgmt.testbase.models import TestBaseAccountSKU
# requesting token from Azure CLI for request
# For other authentication approaches, please see: https://pypi.org/project/azure-identity/
credential = AzureCliCredential()
subscription_id = "<subscription-id>"
resource_group = "<resource-group-name>"
testBaseAccount_name = "contoso-testbaseAccount"
testBaseAccount_location = "global"
sku_name = "S0"
sku_tier = "Standard"
sku_locations = {"global"}
# Create client
testBase_client = TestBase(credential, subscription_id)
# Create sku for test base account
sku = TestBaseAccountSKU(name=sku_name, tier=sku_tier, locations=sku_locations)
# Create test base account
parameters = TestBaseAccountResource(location=testBaseAccount_location, sku=sku)
testBaseAccount = testBase_client.test_base_accounts.begin_create(resource_group, testBaseAccount_name, parameters).result()
print("Create test base account:\n{}".format(testBaseAccount))
Check below links to learn more details about the SDK & API.
Azure subscription
Python SDK
REST API
We are continuously gathering and collaborating on feedback to prioritize and improve the future for Test Base. Email us at tbcomms@microsoft.com, we look forward to hearing your feedback and comments!
We are actively engaging with application developers and enterprise customers now to add more value and help solve additional use cases. We would also like to invite you to come join us at the new Test Base for M365 community on Tech Community so you can share your experiences and connect with others using the service.