Hello @Sergey Gorbushin ,
Thanks for your query and for the detailed notes.
I was able to repro your issue locally for my azure storage account with private endpoint enabled.
Below is the working Complete Module but with StorageAccountKey (not SAS) - I think it should also work for SAS with minor changes.
static void StorageAccount_Enabled_PrivateEndPoint_CreateContainerAndUploadFiles()
{
try
{
// Get a connection string to our Azure Storage account.
string connectionString = "DefaultEndpointsProtocol=https;AccountName=testsa;AccountKey=key==;EndpointSuffix=mylocalip";
//connectionString = ConfigurationManager.ConnectionStrings["connstr"].ConnectionString;
string containerName = "test3";
string filePath = "License.txt";
// Get a reference to a container and then create it
BlobContainerClient container = new BlobContainerClient(connectionString, containerName);
container.CreateIfNotExists();
// upload blobs
container.UploadBlob("first", File.OpenRead(filePath));
container.UploadBlob("second", File.OpenRead(filePath));
container.UploadBlob("third", File.OpenRead(filePath));
// Print out all the blob names
foreach (BlobItem blob in container.GetBlobs())
{
Console.WriteLine(blob.Name);
}
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Couple of Most Important Points:
1) In the connection string when you copy from Azure Portal Storage Account , there will be couple of spaces between them . Try removing those spaces. (For example below)
AccountName = testshp
AccountKey=key==
2) If you want to mention your IP address in the constructor for the parameter (EndpointSuffix=10.1.1.1). Make sure to add your clientIP address using the portal storage account.
StorageAccount -> Networking -> Firewall (Section) -> Check the box (Add your clientIP address)
3) Try adding your localIP in the connection string itself instead of passing to constructor
4) JUST FYI- Couple of below articles also points to the error message "No valid combination of account information found." - which was resolved by mentioned the connection string in the App.config file (But it might not be true , as I was able to run both in the code and app.config file)
Additional references:
If the above steps resolves your issue , please "Accept the Answer" so that it can be help to the community out there.