无论如何,您可以检查Azure CLI在后台执行哪些API调用吗? [英] Is there anyway you can check what API calls is the Azure CLI doing under the hood?

查看:56
本文介绍了无论如何,您可以检查Azure CLI在后台执行哪些API调用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用适用于Azure的Python SDK,但是我看到文档缺少适当的信息和示例.我知道Azure CLI是建立在适用于Azure的Python SDK之上的,因此我想知道是否可以通过某种方式知道执行以下操作时所调用的Python函数:"az vm show" .

这样,我可以使用Azure CLI轻松构建命令并将其转换为Python代码.

谢谢!

解决方案

您可以看到Python流程发布的基础API.

为此,您可以使用fiddler或任何可以捕获流量的客户端应用程序.

对于Fiddler,您可以从

有关此问题的更多信息,请参见 解决方案

You can see the underlying API that issued by the Python Process.

To do that, you could use fiddler or any client application that can capture traffic.

For Fiddler you can download and install from here

You will have enable Decrypt HTTPS traffic as all the traffic to Azure through CLI is done through HTTPs. Refer this for more information

Fiddler on running will now act as a proxy and will capture all the network traffic.

However, you will NOT be able to run the Azure CLI directly with the Fiddler on (Proxy) in place. You will have to add the certificate of the Fiddler to that of CLI's.

The fiddler Certificate can be found at http://localhost:8888. You will have to export the certificate and convert it to PEM format. The exported format is in .CRT

You can locally do this like mentioned here or use online tool to do this example :https://www.sslshopper.com/ssl-converter.html

Once you have the PEM Certificate - append the contents of this to certificate file that the CLI uses :

C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem

<Original cacert.pem>

-----BEGIN CERTIFICATE-----
<Your proxy's certificate here>
-----END CERTIFICATE-----

Now you will be able to intercept the traffic issued from a python process.

More information on this is documented here

这篇关于无论如何,您可以检查Azure CLI在后台执行哪些API调用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆