Skip to content

Instantly share code, notes, and snippets.

@ramnov
Created August 17, 2018 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnov/82772b762cc6c54e71fad041de02a3b1 to your computer and use it in GitHub Desktop.
Save ramnov/82772b762cc6c54e71fad041de02a3b1 to your computer and use it in GitHub Desktop.
Python script to modify jwtsigningcertificate in Microsoft Machine Learning Server Webnode appsettings.json
#!/usr/bin/python
import sys
import json
from collections import OrderedDict
appSettingsFilePath = "/opt/microsoft/mlserver/9.3.0/o16n/Microsoft.MLServer.WebNode/appsettings.json"
data = json.loads(open(appSettingsFilePath, "r").read().replace("\r\n",""), object_pairs_hook=OrderedDict)
data["Authentication"]["JWTSigningCertificate"]["Enabled"] = True
data["Authentication"]["JWTSigningCertificate"]["StoreName"] = "Root"
data["Authentication"]["JWTSigningCertificate"]["StoreLocation"] = "CurrentUser"
data["Authentication"]["JWTSigningCertificate"]["SubjectName"] = "CN=LOCALHOST"
with open(appSettingsFilePath, "w") as f:
json.dump(data, f, indent=4, sort_keys=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment