AzureAuth icon indicating copy to clipboard operation
AzureAuth copied to clipboard

Improve documentation for password protected pem files

Open aapeebles opened this issue 2 years ago • 1 comments

Hello! I have a a registered app on an enterprise account. My Dev team uses both R and Python. I'm trying to adapt the Python code to use AzureAuth, but I'm hitting a wall with documentation and error messages.

Variables I have:

  • Tenant ID
  • Client ID (app id)
  • Thumbprint
  • pem file
  • password to unlock pem file

When I try the code below (trying both the absolute file name and the path to the file) I get this error: Error in read_input(file) : file must be connection, raw vector or file path

It's also unclear where to enter the pem password or the thumbprint.

Could you please provide a vignette for a password protected pem file and thumbprint?


resource <-"https://graph.microsoft.com/.default"
cert_path <- "C:/Users/<username>/Documents/repo_work/api_r_demo/CHCAnalyticsAutomation.pem"

get_azure_token(resource, 
                           creds$TENANT_ID,  
                           creds$CLIENT_ID,
                           certificate=cert_path, 
                           auth_type="client_credentials")

aapeebles avatar Mar 16 '22 22:03 aapeebles

Hi, it's been some time since I looked at cert authentication, but:

  • make sure your file exists at the path given
  • a PEM file should look like this:
-----BEGIN PRIVATE KEY-----
MIIEvQ...
...
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDKD...
...
-----END CERTIFICATE-----

Ie, it should have both the public and private keys in a text format.

hongooi73 avatar Mar 21 '22 08:03 hongooi73