Azure-Samples / container-apps-store-api-microservice

Sample microservices solution using Azure Container Apps, Dapr, Cosmos DB, and Azure API Management
MIT License
340 stars 420 forks source link

Azure Container Apps Dapr state store with Azure Blob Store #24

Closed athrayee closed 2 years ago

athrayee commented 2 years ago

I am using Azure Container apps with Azure Blob Store as a state store. It is a simple Hello World (weather service) app using dotnet 6. App starts up fine, on Post I am trying to save the generated weather information to Azure Blob Store as JSON. I have configured Dapr components in Azure Container Apps for StateStore using Azure blob storage. I am using storage key (secondary key) as explained in this Microsoft documentation

Upon doing a Swagger and looking at log I get the following error.

Dapr.DaprException: State operation failed: the Dapr endpoint indicated a failure. See InnerException for details. 2022-07-17T01:10:35.716245402Z ---> Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="failed saving state in state store statestore: -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError, /home/vsts/work/1/go/pkg/mod/github.com/!azure/azure-storage-blob-go@v0.10.0/azblob/zc_storage_error.go:42 2022-07-17T01:10:35.716524109Z ===== RESPONSE ERROR (ServiceCode=AuthenticationFailed) ===== 2022-07-17T01:10:35.716795515Z Description=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. 2022-07-17T01:10:35.716812515Z RequestId:863bcef4-401e-0069-5f7a-99724b000000 2022-07-17T01:10:35.716820115Z Time:2022-07-17T01:10:35.7137648Z, Details: 2022-07-17T01:10:35.716825516Z AuthenticationErrorDetail: Issuer validation failed. Issuer did not match. 2022-07-17T01:10:35.716831516Z Code: AuthenticationFailed

RESPONSE Status: 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I am unsure what I am missing since I am not making any additional config in storage account such as VNET service end point etc. Account is enabled for Key access. Any help is appreciated.

Below is the code that I am using

using var client = new DaprClientBuilder().Build();

var forecast = new WeatherForecast()

{ Date = DateTime.Now.AddDays(1), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] };

await client.SaveStateAsync<WeatherForecast>(stateStoreName,key,forecast);

stateStoreName is "statestore" which is what i have names in Dapr Components in ACS key is a string "weatherforecast"