适用版本: 6.8-8.9
1. 错误异常的基本描述 #
这条异常表示 Azure 仓库客户端没有拿到任何可用凭据。源码在构建连接字符串前会检查 sasToken 和 key,若两者都为空,就抛出 SettingsException。
常见现象 #
- Azure 仓库在初始化或验证时失败。
- 配置里定义了 client,但没有真正可用的认证信息。
- 常见于 keystore 未注入、环境变量为空或配置迁移遗漏。
典型报错与异常栈 #
SettingsException: Neither a secret key nor a shared access token was set.
2. 为什么会发生这个错误 #
Azure 仓库必须至少有一种认证方式。若 secret key 和 SAS token 都没有,客户端根本无法建立连接。常见原因包括:
- keystore 或环境变量没有正确加载。
- 部署模板遗漏凭据字段。
- 密钥轮换时旧值被删,新值未生效。
3. 如何排查和解决这个异常和解决这个异常 #
- 检查 Azure client 使用的认证方式设计。
- 确认 secret key 或 SAS token 是否至少存在一个。
- 核对 keystore、环境变量和配置模板是否都已生效。
- 在节点侧检查敏感配置是否正确加载。
- 修复后重新验证仓库。
4. 如何解决这个错误 #
常用修复思路 #
- 为 Azure client 补齐 secret key 或 SAS token。
- 检查 keystore 注入流程和部署变量。
- 对凭据加载失败建立显式告警。
后续注意事项与推荐建议 #
- 凭据轮换流程必须包含生效确认。
- 对仓库配置发布增加“至少一种认证方式存在”的校验。
借助 INFINI 产品提升排障效率 #
- INFINI Console 可帮助定位配置失效时间。
- INFINI Gateway 可辅助分析异常发生前后的发布活动。
5. 小结 #
Neither a secret key nor a shared access token was set 的根因是 Azure 客户端没有任何可用凭据。补齐至少一种认证方式即可恢复。
相关错误 #
- both-a-secret-as-well-as-a-shared-access-token-were-set-how-to-solve-this-elasticsearch-exception
- invalid-azure-client-settings-with-name-clientname-how-to-solve-this-elasticsearch-exception
- if-you-want-to-use-an-azure-repository-you-need-to-define-a-client-configuration-how-to-solve-this-elasticsearch-exception
附:日志上下文 #
if (hasSasToken == false && hasKey == false) {
throw new SettingsException("Neither a secret key nor a shared access token was set.");
}





