postgresql - AzureStorageClient raises the error Unable to determine account name for shared key credential - Stack Overflow

时间: 2025-01-06 admin 业界

AzureStorageClient raises the error:

Unable to determine account name for shared key credential

This is the line of code that I am trying to use to connect to my azure account, I am trying to connect this with my Azure Storage Account

storage_client = AzureStorageClient(account_url=<blob_service_url>, container=<container_name>, credential=<connecion_string>)

I am trying to use Azure blob storage as my storage client to use with Azure Database for PostgreSQL using SQLAlchemyDataLayer as my data layer.

I know this could be caused by the use of bad key on my part, but I am using the same keys for other functions and they work fine.

I am frankly new using Azure, and chainlit, and I have tried all I can think about to solve this.

I would be thankful for any insight or guidance on this matter.

I expected it to work, and I try using different keys, and read the documentation and cannot find my mistake

AzureStorageClient raises the error:

Unable to determine account name for shared key credential

This is the line of code that I am trying to use to connect to my azure account, I am trying to connect this with my Azure Storage Account

storage_client = AzureStorageClient(account_url=<blob_service_url>, container=<container_name>, credential=<connecion_string>)

I am trying to use Azure blob storage as my storage client to use with Azure Database for PostgreSQL using SQLAlchemyDataLayer as my data layer.

I know this could be caused by the use of bad key on my part, but I am using the same keys for other functions and they work fine.

I am frankly new using Azure, and chainlit, and I have tried all I can think about to solve this.

I would be thankful for any insight or guidance on this matter.

I expected it to work, and I try using different keys, and read the documentation and cannot find my mistake

Share Improve this question asked yesterday Anna Bianca Marzetti BiggiAnna Bianca Marzetti Biggi 211 silver badge1 bronze badge New contributor Anna Bianca Marzetti Biggi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 1

AzureStorageClient Class requires Data Lake Storage endpoint, instead of Blob Service endpoint. The line of code you are using to connect to azure account is supposed to be:

storage_client = AzureStorageClient(account_url="https://{}.dfs.core.windows.net".format('<storage_account>'), container='<container>', credential='<key>')

You can find Data Lake Storage endpoint from Endpoints tab of Storage Account in Azure portal. See the screenshot:

Just FYI: In below screenshot from VS Code, if you pay attention to account_url sample parameter, you can see that the url with .dfs. is provided which is Data Lake Storage endpoint.

最新文章