Questions tagged [azure-sdk-python]
302 questions
23
votes
2 answers
Azure Python SDK: 'ServicePrincipalCredentials' object has no attribute 'get_token'
So I have the following Python3 script to list all virtual machines.
import os, json
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.resource import…

dom_weissb03
- 415
- 2
- 5
- 8
8
votes
4 answers
List subscriptions for a given Azure account
I'm trying to list the subscriptions in an Azure account using azure-python-sdk.
I have followed this link in…

Varun
- 119
- 1
- 1
- 6
7
votes
2 answers
"Could not retrieve credential from local cache for service principal" when using Azure CLI 2.30.0 credentials in Python SDK on Azure Devops MS agent
I an Azure Pipeline on a self-hosted agent I use this task
- task: AzureCLI@2
displayName: Azure CLI task with Python SDK
inputs:
azureSubscription: 'SUBSCRIPTION-SERVICE-CONNECTION'
scriptType: bash
…

Kai Walter
- 3,485
- 2
- 32
- 62
7
votes
3 answers
Azure Table Storage vs CosmosDB with Python
I am trying to access Azure Table Storage via python.
Following an old walkthrough here:
https://learn.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-python#install-the-azure-storage-sdk-for-python
but the Python SDK it references…

ASX
- 635
- 7
- 18
6
votes
4 answers
Exception: AttributeError: 'DefaultAzureCredential' object has no attribute 'signed_session' using Azure Function and Python
I wrote an Azure function that runs Python3 to simply turn on an Azure VM.
The function app has a system assigned managed identity that I've given VM contributor role. To have the function use the Managed Identity, I am using the…

Steve Townsend
- 81
- 1
- 4
6
votes
1 answer
Failing to upload larger blobs to Azure: azure.core.exceptions.ServiceRequestError: The operation did not complete (write) (_ssl.c:2317)
I'm trying to upload some larger blobs (>50MB) to my Azure storage container using the Python SDK:
connect_str = os.environ['AZURE_STORAGE_CONNECTION_STRING']
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
def…

Lowroad
- 153
- 1
- 10
6
votes
2 answers
Upload CSV file into Microsoft Azure storage account using python
I am trying to upload a .csv file into Microsoft Azure storage account using python. I have found C-sharp code to write a data to blob storage. But, I don't know C# language. I need to upload .csv file using python.
Is there any example of python to…

msc
- 33,420
- 29
- 119
- 214
5
votes
3 answers
AzureML Dataset.File.from_files creation extremely slow even with 4 files
I have a few thousand of video files in my BlobStorage, which I set it as a datastore.
This blob storage receives new files every night and I need to split the data and register each split as a new version of AzureML Dataset.
This is how I do the…

3nomis
- 1,175
- 1
- 9
- 30
5
votes
2 answers
Receiving the error Code: SubscriptionNotFound Message: The subscription not found when trying to get data about Azure Virtual Machine?
I am working on a script that accesses details about an Azure Virtual Machine currently. This is the code that I have so far:
"""
Instantiate the ComputeManagementClient with the appropriate credentials.
@return ComputeManagementClient…

greendaysbomb
- 364
- 2
- 6
- 23
5
votes
1 answer
Where can I find Service Principal GUID from Azure Portal
I need to create a service principal and assign a new role to it through Python SDK. I am currently following steps as listed from this stackoverflow question.
I am currently working on the role assignment and I am stuck on the step of I need to…

user1655072
- 572
- 2
- 10
- 20
5
votes
2 answers
How to copy a blob from one container to another container using Azure Blob storage SDK
I have been referring to the document https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python. I have not been able to find the proper APIs for copy/move a file from one container to another container. Let's say I have…

kanchan
- 65
- 1
- 5
5
votes
1 answer
Azure Python SDK for Blobs - ImportError: cannot import name 'BlobClient'
I'm writing code to download a Blob from Azure but I can't import BlobClient.
from azure.storage.blob import BlobClient
cs = "CONNECTION_STRING"
blob = BlobClient.from_connection_string(cs, container="mycontainer", blob="config.ini")
with…

Evandro Pomatti
- 13,341
- 16
- 97
- 165
5
votes
3 answers
Is there a azure python sdk to retrieve application insights data?
I use below App insights python sdk to send my custom metrics in app insights resource.
https://github.com/Microsoft/ApplicationInsights-Python
Now when I want to retrieve it, all i can find is Rest API based method to retrieve it.…

explorer
- 737
- 1
- 8
- 23
5
votes
2 answers
Azure CLI vs Python SDK
Is there a recommended approach in terms of using either Azure CLI or the Azure Python SDK?
The CLI seems to be better documented but since it's built on Python, I would assume it will eventually share a lot of the functionality of the Azure Python…

vonec
- 681
- 10
- 22
4
votes
1 answer
Run command in linux vm in azure using python sdk
I have found that azure python sdk has provided following method for running command in linux vm.
from azure.mgmt.compute import compute_management_client
from azure.common.credentials import ServicePrincipalCredentials
credentials =…

Suraj Shrestha
- 728
- 11
- 19