Azure Cosmos 主令牌到期 [英] Azure Cosmos Master Token Expiration

查看:34
本文介绍了Azure Cosmos 主令牌到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相当新的Azure Cosmos Db.开始实现对 Cosmos 的一些直接 http 调用.

Fairly new Azure Cosmos Db. Starting to implement some direct http calls to the Cosmos.

我已经成功创建了一个 Master Token 并在我的 Postman 环境中使用它.我可以访问数据.问题是最终这个 Master Token 超时了,我想这让我很困惑.

I have successfully created a Master Token and used it inside my Postman environment. I can access data. The trouble is that eventually this Master Token times out, and I guess that confuses me.

Master Token 有寿命吗?我希望能够为我的服务创建 1x 令牌并完成它,但我开始认为我需要在某处设置 Resource Token 中间件.

Does a Master Token have a limited life? I was hoping to be able to create 1x token for my service and be done with it, but I'm starting to think I'll need to setup the Resource Token middleware somewhere.

谁能解释一下我应该如何使用 Master Token,这个名字让我失望,因为它听起来像 Master 应该永远存在(对我来说)但它只对 15 有用分钟.Master Token 是否只是用于运行测试?

Can anyone shed light on how I'm expected to use a Master Token, the name throws me off because it sounds like Master should last forever (to me) yet it is only good for 15 minutes. Is a Master Token simply just used to run testing?

我一直在使用这个网站作为我的资源:https://docs.microsoft.com/en-us/rest/api/cosmos-db/access-control-on-cosmosdb-resources?redirectedfrom=MSDN#构造keytoken

I've been using this site as my resource: https://docs.microsoft.com/en-us/rest/api/cosmos-db/access-control-on-cosmosdb-resources?redirectedfrom=MSDN#constructkeytoken

非常感谢.

推荐答案

主令牌提供对 Cosmos 帐户的管理员访问权限并且不会过期.资源令牌提供对帐户内数据的访问.这些确实会过期,并且最长使用寿命为 5 小时.您需要主令牌来创建资源令牌.您可以在此处了解更多信息.

Master tokens provide admin access to the Cosmos account and do not expire. Resource tokens provide access to the data within the account. These do expire and have max lifetime of 5 hours. You need the master token to create a resource token. You can learn more here.

一般来说,使用 Cosmos DB 的 SDK 之一的体验将为您提供更好的体验,因为它会为您完成一系列工作,包括管理资源令牌.如果使用 .NET 或 Java SDK,您还将获得更快的性能,因为它们都直接与物理分区通信,而不是通过服务的网关.

Generally speaking the experience of using one of the SDK's for Cosmos DB will provide you with a better experience as it does a bunch of work for you, including managing the resource tokens. If using the .NET or Java SDK's you'll also get faster performance as these both talk directly to the physical partitions rather than going through the services' gateway.

这篇关于Azure Cosmos 主令牌到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆