web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

403 Forbidden when accessing blob storage

(0) ShareShare
ReportReport
Posted on by 632

Hi All,

I am getting below error while i try to read excel file from Azure to D365FO.

Microsoft.Dynamics.Ax.Xpp.ClrErrorException: StorageException ---> Microsoft.WindowsAzure.Storage.StorageException:
 The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: 
(403) Forbidden. at System.Net.HttpWebRequest.GetResponse() at Microsoft.WindowsAzure.Storage.Core.Executor.
Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) --- End of
 inner exception stack trace --- at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, 
IRetryPolicy policy, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob
.OpenRead(AccessCondition accessCondition,
 BlobRequestOptions options, OperationContext operationContext) at Dynamics.AX.Application.earth_AzureKeyname.
`main(Args _args) in xppSource://Source/ at Dynamics.AX.Application.
earth_AzureKeyname.main(Args _args) at  Microsoft.Dynamics.Ax.Xpp.
ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters) --- End of inner exception stack
 trace --- at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] 
parameters) at Dynamics.AX.Application.SysClassRunnerHelper.`runMainMethod(SysClassRunnerState state) in
 xppSource://Source/ApplicationFoundation\AxClass_SysClassRunnerHelper.xpp:line 30 at Dynamics.AX.Application.
SysClassRunnerHelper.runMainMethod(SysClassRunnerState state) at Dynamics.AX.Application.Forms.SysClassRunner.FormControl.
timerControl.elapsed() in xppSource://Source/ApplicationFoundation\AxForm_SysClassRunner.xpp:line 52

The remote server returned an error: (403) Forbidden.

Below are the code which i am using.

 CloudBlobClient     cloudBlobClient;
        CloudBlobContainer  cloudBlobContainer,blobContainer;
        CloudStorageAccount cloudStorageAccount;

        cloudStorageAccount = CloudStorageAccount::Parse("Azure Id");
        cloudBlobClient     = cloudStorageAccount.CreateCloudBlobClient();
        cloudBlobContainer  = cloudBlobClient.GetContainerReference("test");
              

       
        CloudBlockBlob blob                 = blobContainer.GetBlockBlobReference("Test.xlsx");             

        System.IO.Stream memory             = blob.openRead(null,null,null);

 System.IO.Stream memory             = blob.openRead(null,null,null); on this line i am getting the error.

Kindly help me on it.

Regards.

Rahul

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Rahul,

    If you are getting an 403 error, it is because the credentials to connect to the Azure blob. Is this the actual code you are using or are you using a different parameter in CloudStorageAccount::Parse()?

    cloudStorageAccount = CloudStorageAccount::Parse("Azure Id");

    For an example, here is a code I am using to connect to Azure blob

    CloudBlobClient                 blobClient;
    CloudBlobContainer              blobContainer;
    CloudStorageAccount             storageAccount;
    str                             connectionString;
    
    connectionString                = strfmt("DefaultEndpointsProtocol=https;AccountName=%1;AccountKey=%2;EndpointSuffix=core.windows.net", _storageAccountName, _accountKey);
    storageAccount                  = CloudStorageAccount::Parse(connectionString);
    blobClient                      = storageAccount.CreateCloudBlobClient();
    blobContainer                   = blobClient.GetContainerReference(_blobContainerName);

  • Rahul.p Profile Picture
    632 on at

    Hi Gunjan,

    Using below link i am doing setup in D365FO.

    https://www.linkedin.com/pulse/how-securely-store-retrieve-secrets-passwords-azure-x-zein-al-abdin

    And using below code i am getting CloudStorageAccount::Parse(connectionString); value.

    KeyVaultCertificateTable    certificateTable    = KeyVaultCertificateTable::findByName(_keyvaultSecretName);
        str keyvaultValue = KeyVaultCertificateHelper::getManualSecretValue(certificateTable.RecId);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans