'How can I save a dictionary in Azure key vault, or convert a string to a dictionary that is redacted?

so I am trying to have this secret saved in the azure key vault as a dictionary rather than a string, or else convert it once the secret is retrieved. Lets say I have the dictionary:

my_dict = {"1": "apple", "2": "ball"}

I have this saved in Azure Key Vault and call on Databricks to retrieve this secret. However, whenever I call this dictionary it is a string. This is the syntax for calling the secret.

temp = dbutils.secrets.get(scope = "Placeholder", key = "PlaceHolder1")

When I call temp, it is shown as [Redacted] and the type is a string., which it should be. My question is how to map this string as a dictionary. I tried **temp, json.loads(temp) and json.dumps(temp) and none have worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source