【发布时间】:2017-02-01 10:31:44
【问题描述】:
谁能举例说明使用 Microsoft Azure 管理库 (MAML) 来扩展 Redis 缓存服务?
我必须使用旧版本的 Microsoft.Azure.Management.Redis.dll、v0.9.0.0,因此 RedisManagementClient 不接收令牌,而只接收凭据。这种情况会出现异常
"AuthenticationFailed: 身份验证失败。'Authorization' 标题丢失。”
这是我正在使用的代码:
public static void ScaleRedis(eSubscriptionType subscriptionType)
{
RedisManagementClient client = new RedisManagementClient(AzureCredentials.GetCredentials(subscriptionType));
var redisParams = new RedisCreateOrUpdateParameters()
{
Properties = new RedisProperties(version, new Sku(redisSKUName, redisSKUFamily, redisSKUCapacity), false),
Location = redisCacheRegion
};
client.Redis.CreateOrUpdate(resourceGroupName, cacheName, redisParams);
}
【问题讨论】:
-
我已经更新了我的回复。有任何问题,请告诉我。
-
这似乎是正确的答案,只有与 AD 的关系对我们来说是新的,现在我们尝试获取 clientId 和tenentId,当我们管理时,我会将其标记为最佳答案。我在代码中看到了 Redis 访问密钥的链接,但是访问密钥的使用在哪里?
-
access-keys 结合端点用作连接字符串,当您将 Azure Redis 缓存与客户端库(例如 StackExchange.Redis)连接时,您可以参考此 tutorial。
-
由于您使用 MAML 来管理(创建/更新)您的 Azure Redis 缓存,因此与
access-keys没有任何关系。您只需要按照我的笔记中的资源来创建您的广告应用程序并检索令牌。有任何问题,请告诉我。
标签: azure redis azure-sdk-.net azure-redis-cache