我制作了一个在 Azure 上发布的 Web API 服务。我希望能够从此服务写入我的 blob 存储,因此我需要为存储连接字符串添加一个环境变量。在控制台(在应用程序服务的开发工具下)中,我编写命令:
D:\home\site\wwwroot>setx AZURE_STORAGE_CONNECTION_STRING "<MyConnectionString>"
但我收到消息:
Error: Access to the registry path is denied
最佳答案
您可以导航到网络应用的配置
部分,在门户中设置连接字符串,并添加名为“AZURE_STORAGE_CONNECTION_STRING”的新 key 和值
或使用 CLI command
设置连接字符串,
az webapp config connection-string set --connection-string-type {ApiHub, Custom, DocDb, EventHub, MySql, NotificationHub, PostgreSQL, RedisCache, SQLAzure, SQLServer, ServiceBus}
[--ids]
[--name]
[--resource-group]
[--settings]
[--slot]
[--slot-settings]
[--subscription]
关于azure - 如何在 Azure 上为我的应用程序服务设置环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60139849/