Skip to content

Using Azure Key Vault Certificates with SharePoint ClientContext #711

@williambrach

Description

@williambrach

Hi everyone,

I have a question regarding using a certificate from Azure Key Vault in conjunction with a SharePoint ClientContext. I would like to know if there's a way to achieve auth with Azure Key Vault.

I tried to use client id and client secret from app registration but for some reason it doesn't work for me

('-2147024891, System.UnauthorizedAccessException', 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))', "403 Client Error: Forbidden for url:
cert_credentials = {
    'tenant': test_tenant_name,
    'client_id': test_client_id,
    'thumbprint': test_cert_thumbprint,
    'cert_path': '{0}/selfsigncert.pem'.format(os.path.dirname(__file__)),
}
ctx = ClientContext(test_site_url).with_client_certificate(**cert_credentials)

I would appreciate any insights or examples on how to properly utilize the certificate from Azure Key Vault in the SharePoint ClientContext. Thank you in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions