Skip to content Skip to sidebar Skip to footer

Is It Anyway To Get Ftpsstate Of Azure Web App (azure Function App) Using Python Sdk?

The problem is that with the python SDK I am not able to list all config info related to Azure function app. So with python SDK get_configration() API in not containing a key ftpsS

Solution 1:

I tried to reproduce your issue successfully, and I found it was caused by the current packages azure==4.0.0 and azure-mgmt-web==0.35.0 not support the ftps_state attribute if you install them via pip install azure or pip install azure-mgmt-web. You can refer to the source code site_config_resource.py of azure_4.0.0 and its master version to discover it.

site_config_resource.py of azure 4.0.0 tag

enter image description here

site_config_resource.py of master branch

enter image description here

So first, you need to uninstall all packages of azure-sdk-for-python via pip, as below.

pip freeze > packages_uninstalled_requirements.txt
pip uninstall -r packages_uninstalled_requirements.txt -y

Then, you must have to install the package azure-mgmt-web from the azure-sdk-for-python source repo, as below.

git clone git://github.com/Azure/azure-sdk-for-python.git
cd azure-sdk-for-python
python setup.py install

cd sdk/appservice/azure-mgmt-web
python setup.py install

Then, run my sample code and get the result you want, as below.

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.web import WebSiteManagementClient

subscription_id = '<your subscription id>'
credentials = ServicePrincipalCredentials(
    client_id='<your client id>',
    secret='<your client secret>',
    tenant='<your tenant id>'
)

resource_group_name = '<your resource group name>'
name = '<your webapp or function name>'

client = WebSiteManagementClient(credentials, subscription_id)
conf = client.web_apps.get_configuration(resource_group_name, name)
print(conf.name, conf.ftps_state)

enter image description here

Post a Comment for "Is It Anyway To Get Ftpsstate Of Azure Web App (azure Function App) Using Python Sdk?"