Azure / Azure/azure-powershell

Set-AzRedisCache tries to list access keys even if just scaling

Open Beginner friendly
#26,002 3 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad bug customer-reported Redis Cache Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

The `Set-AzRedisCache` cmdlet always tries to get the access keys here:
https://github.com/Azure/azure-powershell/blob/f7f6764da88d2631c44e8f273f0884dd32c61490/src/RedisCache/RedisCache/Commands/SetAzureRedisCache.cs#L136

This has apparently no other reason than to provide the output object as `RedisCacheAttributesWithAccessKeys`.

We use a specific low-privilege **CompliantContributor** ACL role to perform Redis operations. It has permissions to update shard count, but not to read the access keys (and thus the actual customer data).

The command seems to fail today for us:
```
PS C:\Scripts> Set-AzRedisCache -Name trouter-pub-ent-plce-11-ms-v5-0 -ShardCount 5
Set-AzRedisCache: Operation returned an invalid status code 'Forbidden'
```
But it actually does start the scaling operation in the background.

This is confusing and misleading.

Hence, consider making the list access keys operation optional for `Set-AzRedisCache`, so that its failure would not fail the whole command, at least for the operations that do not need them.

Thank you for your consideration

Contributor guide

Open the contributing guide

Research direction

Start in src/RedisCache/RedisCache/Commands/SetAzureRedisCache.cs around line 136, where Set-AzRedisCache retrieves access keys. Reproduce the shard-scaling command with a role that cannot read keys, then verify scaling succeeds without that permission while the command's output remains appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell, redis
Domain
cli, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.