I´m trying to get Access keys connection strings f...
# getting-started
s
I´m trying to get Access keys connection strings from Azure Redis but but just can figure it out Here I create a Redis and then try to access the
Copy code
var redis = new AzureNative.Cache.Redis("myCache", new AzureNative.Cache.RedisArgs
{
    EnableNonSslPort = false,
    Location = ResourceGroup.Apply(t => t.Location),
    MinimumTlsVersion = "1.2",
    RedisConfiguration = new AzureNative.Cache.Inputs.RedisCommonPropertiesRedisConfigurationArgs
    {
        MaxmemoryPolicy = "allkeys-lru",
    },
    ResourceGroupName = ResourceGroup.Apply(t => t.Name),
    Sku = new AzureNative.Cache.Inputs.SkuArgs
    {
        Capacity = 0,
        Family = "C",
        Name = "Basic",
    },
    Tags =
{
    { "environment", StackName },
},
});

// first I tried this
var attempt1 = redis.AccessKeys.Apply(c => c.PrimaryKey); //Fails here!

// and how can I even log out any value at all just to see
<http://Log.Info|Log.Info>($"message {redis.AccessKeys.Apply(c=>c.PrimaryKey)}");
When I do "up" it looks good but then it all fails with this error
Copy code
failed with an unhandled exception:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at void AppStack.SetupRedis()+(RedisAccessKeysResponse c) => { } in AppStack.cs:line 24
       at Output<U> Pulumi.Output<T>.Apply<U>(Func<T, U> func)+(T t) => { }
but if I check the portal there are AccessKeys as you can see from the images so what is the problem? How does this even work? Here is a (all) the code I have currently created https://github.com/sturlath/MyTest/blob/68592cf1495d2c802e50dcb926682106dbc88251/AppStack.cs#L612