首页 > 解决方案 > 获取 Azure Batch 批处理帐户可用的应用程序包列表

问题描述

我正在制作一个启动批处理的 python 应用程序。我想通过用户输入创建一个池。为简单起见,我只是将批处理帐户中存在的所有应用程序添加到池中。我无法获得可用应用程序包的列表。这是代码的一部分:

import azure.batch.batch_service_client as batch
from azure.common.credentials import ServicePrincipalCredentials

credentials = ServicePrincipalCredentials(
    client_id='xxxxx',
    secret='xxxxx',
    tenant='xxxx',
    resource="https://batch.core.windows.net/"
)
batch_client = batch.BatchServiceClient(
    credentials,
    base_url=self.AppData['CloudSettings'][0]['BatchAccountURL'])
# Get list of applications
batchApps = batch_client.application.list()

我可以创建一个池,所以凭据很好并且有应用程序,但返回的列表是空的。有人可以帮我吗?

谢谢你,圭多

更新:

我试过:

import azure.batch.batch_service_client as batch

batchApps = batch.ApplicationOperations.list(batch_client)

import azure.batch.operations as batch_operations

batchApps = batch_operations.ApplicationOperations.list(batch_client)

但它们似乎不起作用。batchApps 始终为空。我认为这不是身份验证问题,否则我会收到错误消息。此时我想知道它是否只是python SDK中的一个错误?

我使用的 SDK 版本是:

这是空的 batchApps var 的屏幕截图:

在此处输入图像描述

标签: azureazure-batch

解决方案


这是您要查找的链接吗:

希望这可以帮助。


推荐阅读