Skip to content

Commit 8af4ca7

Browse files
committed
Add passphrase option to certauth
1 parent 94efee6 commit 8af4ca7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = IntuneCD
3-
version = 2.4.1.beta2
3+
version = 2.4.1.beta3
44
author = Tobias Almén
55
author_email = almenscorner@outlook.com
66
description = Tool to backup and update configurations in Intune

src/IntuneCD/intunecdlib/get_accesstoken.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def obtain_accesstoken_app(TENANT_NAME, CLIENT_ID, CLIENT_SECRET):
5656
return token
5757

5858

59-
def obtain_accesstoken_cert(TENANT_NAME, CLIENT_ID, THUMBPRINT, KEY_FILE):
59+
def obtain_accesstoken_cert(TENANT_NAME, CLIENT_ID, THUMBPRINT, KEY_FILE, PASSPHRASE):
6060
"""
6161
This function is used to get an access token to MS Graph using a certificate.
6262
@@ -73,6 +73,7 @@ def obtain_accesstoken_cert(TENANT_NAME, CLIENT_ID, THUMBPRINT, KEY_FILE):
7373
client_credential={
7474
"thumbprint": THUMBPRINT,
7575
"private_key": open(KEY_FILE, encoding="utf-8").read(),
76+
"passphrase": PASSPHRASE,
7677
},
7778
authority=AUTHORITY + TENANT_NAME,
7879
)

src/IntuneCD/intunecdlib/get_authparams.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ def getAuth(mode, localauth, certauth, interactiveauth, scopes, entra, tenant):
3030
THUMBPRINT = os.environ.get("THUMBPRINT")
3131
TENANT_NAME = os.environ.get("TENANT_NAME")
3232
CLIENT_ID = os.environ.get("CLIENT_ID")
33+
PASSPHRASE = os.environ.get("PASSPHRASE")
3334

3435
if not all([KEY_FILE, THUMBPRINT, TENANT_NAME, CLIENT_ID]):
3536
raise ValueError("One or more os.environ variables not set")
36-
return obtain_accesstoken_cert(TENANT_NAME, CLIENT_ID, THUMBPRINT, KEY_FILE)
37+
return obtain_accesstoken_cert(
38+
TENANT_NAME, CLIENT_ID, THUMBPRINT, KEY_FILE, PASSPHRASE
39+
)
3740

3841
if interactiveauth:
3942
TENANT_NAME = os.environ.get("TENANT_NAME")

0 commit comments

Comments
 (0)