admin管理员组文章数量:1336414
Anyone else having a problem to let durable functions runtime get connection to Azure Storage Account? When you are running Local environment on your VS Code.
For me it is stuck on that and after many many attempts it finally works but this can happen for every request. enter image description here
When function is finally invoked then the internal DefaultAzureCredential() is working smoothly. I have no idea which method Durable Functions use I tried to look from the Source code but could not find that logic.
But based on the documentation () it tries to get a token from the following locations, in the said order, for access to your Azure resources:
- A local cache shared between Microsoft applications
- The current user context in Visual Studio
- The current user context in Visual Studio Code
- The current user context in the Azure CLI
I am using PIM account, I have local account.... where I use Teams/Outlook/Devops/ etc...
installed software/other:
Azure Func Core Tools Visual Studio Code Python 3.11 PIM Cloud account
az account clear az login az set subscription then there was some command to disable the WAM and I have tried that aswell.
Any help would be appreciated!
-YourCSVman
I have tried to log out, clear cache -> login again, set subscription to the one where storage account lays but no progress. Also I have tried to func host start --verbose from just command line and not inside VS Code Also I have Logged in with my PIM Cloud account in Azure.
Anyone else having a problem to let durable functions runtime get connection to Azure Storage Account? When you are running Local environment on your VS Code.
For me it is stuck on that and after many many attempts it finally works but this can happen for every request. enter image description here
When function is finally invoked then the internal DefaultAzureCredential() is working smoothly. I have no idea which method Durable Functions use I tried to look from the Source code but could not find that logic.
But based on the documentation (https://learn.microsoft/en-us/azure/azure-functions/durable/durable-functions-configure-managed-identity) it tries to get a token from the following locations, in the said order, for access to your Azure resources:
- A local cache shared between Microsoft applications
- The current user context in Visual Studio
- The current user context in Visual Studio Code
- The current user context in the Azure CLI
I am using PIM account, I have local account.... where I use Teams/Outlook/Devops/ etc...
installed software/other:
Azure Func Core Tools Visual Studio Code Python 3.11 PIM Cloud account
az account clear az login az set subscription then there was some command to disable the WAM and I have tried that aswell.
Any help would be appreciated!
-YourCSVman
I have tried to log out, clear cache -> login again, set subscription to the one where storage account lays but no progress. Also I have tried to func host start --verbose from just command line and not inside VS Code Also I have Logged in with my PIM Cloud account in Azure.
Share edited Nov 22, 2024 at 6:32 Voi Se asked Nov 19, 2024 at 19:33 Voi SeVoi Se 11 bronze badge 2- Please provide your function code. – Pravallika KV Commented Nov 21, 2024 at 3:35
- Is the issue resolved? – Pravallika KV Commented Dec 3, 2024 at 11:16
1 Answer
Reset to default 0Follow below steps to configure Durable Functions with managed identity, refer the blog.
- Create a function app and enable managed identity. I have enabled System Assigned Managed Identity.
- Navigate to the interlinked storage account=>Access Control(IAM)=>Grant
Storage Account Contributor
,Storage Blob Data Contributor
role to the function app's managed identity.
Add AzureWebJobsStorage__accountName: <Storage_Account_Name>
under FunctionApp=>Settings=>Environment Variables=>App Settings:
Code Snippet:
import logging
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient
def main(name: str) -> str:
logging.info(f"Listing blobs for: {name}")
credential = DefaultAzureCredential()
blob_service_client = BlobServiceClient(account_url="https://<storage-account-name>.blob.core.windows/", credential=credential)
container_client = blob_service_client.get_container_client("your-container-name")
blob_list = container_client.list_blobs()
blob_names = [blob.name for blob in blob_list]
return f"Blobs for {name}: {blob_names}"
Output:
Logs:
本文标签:
版权声明:本文标题:Durable Functions + Azure Storage Account -> Multiple retry to Attempting to retrieve authentication token for resource & 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742402954a2468250.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论