- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 ASPNET Core 站点,该站点在我的开发计算机上运行时,利用新的本地 secret 管理器来存储一些初始用户的密码。我通过 IConfigurationRoot.GetSection("username") 访问 secret 存储。
以下是如何在 Startup.cs 中构建 IConfigurationRoot:
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment())
{
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
最后一行是 IConfigurationRoot 属性。
这在开发中效果很好。不幸的是,当我将该网站发布到 Azure 时,没有找到密码。 Azure 不支持 secret 存储,但你可以设置环境变量。根据我读到的内容,我认为如果您使用相同的 key ,当配置代码尝试解析配置信息的请求时,就会找到它们。不幸的是,这不起作用,所以我显然错过了一些东西。
以下是我在 Azure 中配置 key 的方法:
这些 key 与我用来成功访问开发计算机上的 secret 存储的 key 相同。
那么我做错了什么?
最佳答案
据我所知,Secret Manager 工具可以帮助您保密源代码。就像这个tutorial提到:
The Secret Manager tool does not encrypt the stored secrets and should not be treated as a trusted store. It is for development purposes only. The keys and values are stored in a JSON configuration file in the user profile directory.
同时,我们可以发现 secret 存储在用户配置文件目录中的 JSON 文件中。对于 Windows,它将存储在如下路径中:
%APPDATA%\microsoft\UserSecrets\<userSecretsId>\secrets.json
Unfortunately, when I published the site to Azure, the passwords aren't being found.
我关注了这个tutorial通过用户 secret 将我的敏感数据存储在 ASP.NET Core 项目中,发现它在我这边可以很好地工作。将应用程序发布到 Azure 时,您可以利用 Azure 应用服务应用程序设置来覆盖在开发中使用 Secret Manager 工具存储的敏感值。这是一个示例供您理解。
假设存储敏感值的secrets.json文件的结构如下:
{
"AppKeys": {
"mark": "ABCDEF",
"connel": "abcdef"
}
}
然后您可以在 Azure Web 应用程序中配置应用程序设置,如下所示:
为了更好地理解这个想法,您可以关注User Secrets – Storing sensitive data in ASP.NET Core projects和 Working with Azure App Services Application Settings and Connection Strings in ASP.NET Core .
关于azure - ASPNET核心: Accessing App Settings in Azure that Were in Secrets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39628138/
我正在尝试在我的 minikube 上启动并运行 keycloak。 我正在安装keycloak helm upgrade -i -f kubernetes/keycloak/values.yaml
我将我的数据库密码存储到AWS密钥管理器的Secret Value字段中。如果我使用以下代码,如何检索密码值?。在密钥管理器中定义的密钥:密钥在密钥管理器中定义的值:DBPwd。当我写入日志文件时,上
I am storing my database password into the Secret value field in the aws secret manager. How do I
我正在尝试在 AWS CDK 上组合一个相对简单的堆栈,其中涉及来自 aws-ecs-patterns 的 ApplicationLoadBalancedFargateService。 我的问题涉及
今天我在悠闲地阅读时偶然发现了 Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryp
不是一个真正的编程问题,但很想知道 Kubernetes 或 Minikube 如何管理 secret 并在多个节点/pod 上使用它? 假设我创建了一个 secret 来使用 kubectl 提取图
我需要从 AWS dynamoDB 和第三方 https 服务中获取元素并将这些结果合并到 AWS appSyn 中并将结果作为 graphQL 响应发回 我正在使用的第三方服务需要客户端证书。我没有
我收到一个错误: gpg: no default secret key: No secret key gpg: [stdin]: clearsign failed: No secret key GPG
我正在尝试为 kubernetes 集群设置私有(private) docker 镜像注册表。我正在关注 link $ cat ~/.docker/config.json | base64 ew
当我开发一个API服务器时,我需要给API服务器一些账户信息,这些信息不应该给任何人看。K8s对这种情况推荐secret,所以我用了。 但我想知道这个 secret 是否真的是 secret 。 se
在大多数有关在 Kubernetes 中使用 secret 的示例中,您都可以找到类似的示例: apiVersion: v1 kind: Secret metadata: name: mysecr
我正在与 terraform 合作,在 azure 中启动不同的资源。其中一些资源包含敏感数据,我希望将其安全地存储在 aws Secret Manager 中。这在 Terraform 中是可行的过
我有带有有效 key 的 Azure 应用程序注册。 我正在尝试使用 v1.0 获取 token ,如下所示(clientId 是上述应用程序注册的 ID) $body = @{ grant_
本文讨论如何安装 secret 卷。 https://learn.microsoft.com/en-us/azure/container-instances/container-instances-v
我正在使用 kubernetes 将 Rails 应用程序部署到谷歌容器引擎。 遵循 kubernetes secret 文档:http://kubernetes.io/v1.1/docs/user-
我正在与 terraform 合作,在 azure 中启动不同的资源。其中一些资源包含敏感数据,我希望将其安全地存储在 aws Secret Manager 中。这在 Terraform 中是可行的过
我有带有有效 key 的 Azure 应用程序注册。 我正在尝试使用 v1.0 获取 token ,如下所示(clientId 是上述应用程序注册的 ID) $body = @{ grant_
本文讨论如何安装 secret 卷。 https://learn.microsoft.com/en-us/azure/container-instances/container-instances-v
我有一个 python 脚本,它在 AWS 中创建一些访问 key 并将它们存储在 secret 管理器中。 但是,当我存储 key 时,我收到一条错误消息: The secret value can
我在 Secrets Manager 控制台上创建了一个 key 。然后我尝试使用 Go 代码 quickstart guide喜欢 ctx := context.Background() clien
我是一名优秀的程序员,十分优秀!