存储 azuremlsdk 的 azure 凭据最佳实践

storing azure credentials best practice for azuremlsdk

查看 this 下面创建了一个 config.json 文件(我认为):

new_ws <- create_workspace(name = <workspace_name>, 
                           subscription_id = <subscription_id>, 
               resource_group = <resource_group_name>, 
               location = location, 
               create_resource_group = FALSE)
write_workspace_config(new_ws)

完成后,可以像这样捡起来:

ws <- load_workspace_from_config()

我认为对 config.json 文件进行源代码控制不是最佳做法。请问最好的方法是什么(Windows)?

谢谢。

首先,很抱歉,如果这里有任何不适合您的问题的地方,因为我不了解 R。

如果这是一个不会分发的项目(即分发给客户并下载)我会将此数据保存在您本地主机或服务器上的环境变量中并所有开发人员也创建一个 var。这将允许您存储所有凭据和参数而无需提交它们。

这种方法基本上需要您更改从配置文件加载凭据的代码,以便它向您的本地主机变量查询凭据。我找到了一个关于如何在 R 中做到这一点的很好的指南,check it here!

如果这是一个将分发到生产环境中的软件,我会看一下 Azure Key Vault. This will allow you to safely store your secrets and get them when needed, authenticating with the user's account on an Azure AD or AD B2C. There's a nice guide here

最佳,

费利佩