Azure批处理:尝试使用Python SDk创建池时,服务器无法验证请求
当我尝试使用Azure Portal UI在特定虚拟网络子网中创建池时,它会起作用,我可以从这些计算节点访问同一子网上的其他VM。但如果我尝试使用Python SDK这样做:Azure批处理:尝试使用Python SDk创建池时,服务器无法验证请求,python,azure,azure-batch,Python,Azure,Azure Batch,当我尝试使用Azure Portal UI在特定虚拟网络子网中创建池时,它会起作用,我可以从这些计算节点访问同一子网上的其他VM。但如果我尝试使用Python SDK这样做: new_pool = batch.models.PoolAddParameter( id=pool_id, virtual_machine_configuration=batch_models.VirtualMachineConfiguration(
new_pool = batch.models.PoolAddParameter(
id=pool_id,
virtual_machine_configuration=batch_models.VirtualMachineConfiguration(
image_reference=image_ref_to_use,
node_agent_sku_id=sku_to_use),
vm_size=constants._POOL_VM_SIZE,
target_dedicated_nodes=constants._POOL_NODE_COUNT,
max_tasks_per_node=2,
task_scheduling_policy=batch.models.TaskSchedulingPolicy(
node_fill_type=batch.models.ComputeNodeFillType.pack),
start_task=batch.models.StartTask(
command_line=azure_helper.wrap_commands_in_shell('linux', task_commands),
user_identity=batch_models.UserIdentity(auto_user=user),
wait_for_success=True,
resource_files=self.application_files),
network_configuration=batch_models.NetworkConfiguration(subnet_id=constants.AZURE_BATCH_SUBNET_ID),
)
try:
self.batch_client.pool.add(new_pool)
except batch_models.batch_error.BatchErrorException as err:
print_exception()
raise
它给我提供了azure.batch.models.batch_error.BatchErrorException:{'lang':u'en-US','value':u'Server未能对请求进行身份验证。请确保包含签名的授权标头的值格式正确。\n请求ID:xxxxxxxxxxxxxxxxxxxx\n时间:2018-02-01T15:36:25.5107368Z'
如果我在创建池时没有指定network\u配置
参数,它将与Python SDK一起工作。我的子网id的格式为/subscriptions/xxxxxxxxxxxxxx/resourceGroups/xxxxx-compute/providers/Microsoft.Network/virtualNetworks/xxxxx-compute-vnet/subnets/default
有人能告诉我为什么会这样吗?手动创建池是一件痛苦的事情,因为我需要添加许多资源文件URL
谢谢 将计算池与虚拟网络连接需要使用Azure Active Directory进行身份验证。有关更多信息,请参阅。AAD要求列在该条的先决条件部分。请仔细阅读这篇文章,因为它强调了加入虚拟网络池时的其他重要要求和限制
您可以看到一个使用Python SDK使用AAD进行身份验证的示例。我将探索此选项并与您联系!