Python 用 Azure DevTest Labs ライブラリ
管理 API
pip install azure-mgmt-devtestlabs
管理クライアントを作成する
管理クライアントのインスタンスは、以下のコードで作成します。
サブスクリプションの一覧から取得できる をsubscription_id
指定する必要があります。
Python SDK を使用した Azure Active Directory の認証処理と Credentials
インスタンスの作成について詳しくは、「Resource Management Authentication (リソース管理の認証)」を参照してください。
from azure.mgmt.devtestlabs import DevTestLabsClient
from azure.common.credentials import UserPassCredentials
# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'
# See above for details on creating different types of AAD credentials
credentials = UserPassCredentials(
'user@domain.com', # Your user
'my_password', # Your password
)
devtestlabs_client = DevTestLabsClient(
credentials,
subscription_id
)
ラボの作成
async_lab = self.client.lab.create_or_update_resource(
'MyResourceGroup',
'MyLab',
{'location': 'westus'}
)
lab = async_lab.result() # Blocking wait
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Azure SDK for Python