Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Analyze Azure subscriptions to find cost savings via orphaned resources, rightsizing, and usage data
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
cost-optimization/sdk/azure-resource-manager-redis-dotnet.md
1# Redis Management — .NET SDK Quick Reference23> Condensed from **azure-resource-manager-redis-dotnet**. Full patterns4> (cache creation, firewall rules, access keys, geo-replication, patching)5> in the **azure-resource-manager-redis-dotnet** plugin skill if installed.67## Install8dotnet add package Azure.ResourceManager.Redis9dotnet add package Azure.Identity1011## Quick Start1213> **Auth:** `DefaultAzureCredential` is for local development. See [auth-best-practices.md](../auth-best-practices.md) for production patterns.1415```csharp16using Azure.ResourceManager;17using Azure.Identity;18var armClient = new ArmClient(new DefaultAzureCredential());19```2021## Best Practices22- Use `WaitUntil.Completed` for operations that must finish before proceeding23- Use `WaitUntil.Started` when you want to poll manually or run operations in parallel24- Use DefaultAzureCredential for **local development only**. In production, use ManagedIdentityCredential — see [auth-best-practices.md](../auth-best-practices.md)25- Handle `RequestFailedException` for ARM API errors26- Use `CreateOrUpdateAsync` for idempotent operations27- Navigate hierarchy via `Get*` methods (e.g., `cache.GetRedisFirewallRules()`)28- Use Premium SKU for production workloads requiring geo-replication, clustering, or persistence29- Enable TLS 1.2 minimum — set `MinimumTlsVersion = RedisTlsVersion.Tls1_2`30- Disable non-SSL port — set `EnableNonSslPort = false` for security31- Rotate keys regularly — use `RegenerateKeyAsync` and update connection strings32