admin管理员组文章数量:1134248
My question is simple: I am on development environment where 3-4 secret value related to api url are stored in key vault, which I can access by passing scope and key. Same thing is there in test and higher environment. But for time being my dev api is not working so I want to point to test api in dev environment to do testing, if it works then we do for higher environment.
Can we do this ? I was going through couple of stack question and blog but didn't found fruitful. Please share your valuable thoughts.
My question is simple: I am on development environment where 3-4 secret value related to api url are stored in key vault, which I can access by passing scope and key. Same thing is there in test and higher environment. But for time being my dev api is not working so I want to point to test api in dev environment to do testing, if it works then we do for higher environment.
Can we do this ? I was going through couple of stack question and blog but didn't found fruitful. Please share your valuable thoughts.
Share Improve this question asked Jan 8 at 3:55 chandra prakash kabrachandra prakash kabra 3391 gold badge3 silver badges14 bronze badges 6- please add more details on what you are trying? – JayashankarGS Commented Jan 8 at 4:06
- dbutils.secrets.get("cumu-akv-adb-secret-scope-cp", "CP-API_URL") let say this api url I wanted to get in dev environemnt which will work and it will give dev url , but I wanted to get test url in dev environment how I can achieve it? – chandra prakash kabra Commented Jan 8 at 8:14
- You can still get the value similarly. But you need create seceret in dev env with test url. – JayashankarGS Commented Jan 8 at 9:04
- dbutils.secrets.get("cumu-akv-adb-secret-scope-cp", "Your-test-API_URL") – JayashankarGS Commented Jan 8 at 9:10
- All this 3-4 secret are common to this envs? check if the required secret available in the scope. – JayashankarGS Commented Jan 8 at 9:13
1 Answer
Reset to default 1Actually, with same key name you cannot retrieve the secret like you asked, unless you are changing the secret value that is URL in key vault but that's not recommended.
Below are some ideas you can work on.
Create multiple keys like CP-API_URL_DEV
, CP-API_URL_TEST
..
Now based on environment get the secret.
environment = dbutils.widgets.get("environment")
if environment == "test":
secret_key = "CP-API_URL_DEV"
else:
secret_scope = "CP-API_URL_TEST"
api_url = dbutils.secrets.get(secret_scope,secret_key)
OR
Creating multiple scopes and accessing based on environment like test-secret-scope
, dev-secret-scope
..
environment = dbutils.widgets.get("environment")
if environment == "test":
secret_scope = "test-secret-scope"
else:
secret_scope = "dev-secret-scope"
api_url = dbutils.secrets.get(secret_scope, "CP-API_URL")
Here, key name is same, but scopes is different across environment, being in dev environment access test URL giving test scope name.
OR
save URLs in environment variables and retrieve required one, but this method doesn't use key vault.
At least one of the parameters should be different either scope or secret, both being same across environment can't get the different secret value.
版权声明:本文标题:azure keyvault - Can we get secret value using dbutil in databricks from across envrionment? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736761190a1951555.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论