简体   繁体   English

Ubuntu上的Azure Cli权限被拒绝错误

[英]Azure Cli permission denied error on Ubuntu

I'm working on a project using Python(3) and Django in which I have implemented an application to run few azure cli commands, I have setup a virtual machine with Ubuntu 18.04 and apace2 and deployed my application on it. 我正在使用Python(3)和Django开发一个项目,在该项目中,我已经实现了一个应用程序以运行一些azure cli命令,并已使用Ubuntu 18.04apace2设置了虚拟机,并在其上部署了我的应用程序。

Then I have install the azure-cli and using the it via the Python's subprocess module as: 然后,我安装了azure-cli并通过Python的子进程模块将其使用为:

def auth_group(grp_name):
    # cli().invoke(['login'])
    subprocess2.call(['sudo', 'az', 'login'])
    cli().invoke(['group', 'create', '--name', grp_name, '--location', 'centralus'])

But it returns an err when I check the apache's logs as: 但是当我检查apache的日志时,它返回一个错误:

[Errno 13] Permission denied: '/var/www/.azure'

What can be the cause of this error? 导致此错误的原因是什么?

Thanks in advance! 提前致谢!

You can setup a system assigned VM identity to allow your VM to make calls to ARM. 您可以设置系统分配的VM标识,以允许您的VM调用ARM。

This quickstart shows you how to use a system-assigned identity for a Linux virtual machine (VM) to access the Azure Resource Manager API. 此快速入门向您展示如何使用Linux虚拟机(VM)的系统分配的身份来访问Azure资源管理器API。 Managed identities for Azure resources are automatically managed by Azure and enable you to authenticate to services that support Azure AD authentication without needing to insert credentials into your code. Azure资源的托管身份由Azure自动管理,使您可以向支持Azure AD身份验证的服务进行身份验证,而无需在代码中插入凭据。

https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-linux-vm-access-arm https://docs.microsoft.com/zh-cn/azure/active-directory/managed-identities-azure-resources/tutorial-linux-vm-access-arm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM