skip to Main Content

I need to connect my .Net Core 6.0 web app from Azure to snowflake. I have RSA key stored locally and in the connection string it is referenced:

SnowflakeDbCon": "account=**************;authenticator=snowflake_jwt;user=xxxxxxxx;private_key_file=c:Keysrsa_key.p8;private_key_pwd=yyyyyyyyy;db=dbbbbbbb;schema=MY_SCHEMA;"

Code:
builder.Services.AddScoped(_=>
new SnowflakeDbConnection { ConnectionString = builder.Configuration.GetConnectionString("SnowflakeDbCon") });

This works as expected. But I need to deploy to Azure and I am not sure how the key file path in Azure in the connection string will work.
I tried removing the key file path reference and adding the key file to the project
private_key_file=rsa_key.p8
this works locally, but fails in Azure with the error
Could not find file ‘C:homesitewwwrootrsa_key.p8’

2

Answers


  1. Chosen as BEST ANSWER

    These steps helped me create the key file and upload to the wwwroot folder! TY
    As a side note, I has to change Deployment method to Zip Deploy.


  2. this works locally, but fails in Azure with the error Could not find
    file ‘C:homesitewwwrootrsa_key.p8’

    You change path from C:homesitewwwroot to D:homesitewwwroot and add rsa_key.p8 in this path D:homesitewwwroot by using following steps.

    1. Go to Azure porta.
    2. Click on Application.
    3. In left hand side menu search Advance Tools and select its.

    enter image description here

    1. Open new window. On top menu select Debug console drop down and select CMD.

    enter image description here

    1. Open Console panel select Site->wwwroot-> create p8 file here. Click + icon and add file.

    enter image description here

    1. After adding rsa_key.p8
      enter image description here
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search