Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

c# - This request is not authorized to perform this operation. I used the class "BlobServiceClient" to connect

I have read the page with the same problem as I met.
This request is not authorized to perform this operation. Azure blobClient
I have set the IP, and after I used the class "CloudStorageAccount", I can connect to the Azure Storage.
But I want to use another class "BlobContainerClient" which is used as sample code for connecting to Azure emulator "Azurite".
https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite#azure-blob-storage
And I can successfully connect to Azurite in my Docker. But I will only get the error "This request is not authorized to perform this operation.", when I change the connection string to connect to the real Azure Blob Storage.

var client = new BlobContainerClient(
new Uri("https://myaccount.blob.core.windows.net/container"),
new StorageSharedKeyCredential("myaccount", $"{AccountKey}"));

Here is what my connection string looks like. How can I connect to Azure Storage with this class? Or I should not use this class?

question from:https://stackoverflow.com/questions/65842298/this-request-is-not-authorized-to-perform-this-operation-i-used-the-class-blob

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When use the "Selected network", due to some reasons, like you're using vpn or proxy etc., the client ip which is detected by azure is not very accurate sometimes.

So you can use this cmd command to find your real client ip: curl -L ip.tool.lu. Then manually add it in your azure portal. It works at my side.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...