Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use StorageAccount.GetKeys as expression because it returns null #47264

Open
davidfowl opened this issue Nov 20, 2024 · 0 comments
Open
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Provisioning

Comments

@davidfowl
Copy link
Member

davidfowl commented Nov 20, 2024

var storageVolume = new StorageAccount("storageVolume")
{
    Sku = new StorageSku() { Name = StorageSkuName.StandardLrs },
    Kind = StorageKind.StorageV2,
    LargeFileSharesState = LargeFileSharesState.Enabled
};

BicepValue<string> keys0Value = storageVolume.GetKeys()[0].Value?.Value;

The above returns a null ref. I'm trying to use this in an expression (listKeys()[0].value) and was able to work around it by doing the following:

var keysExpr = storageVolume.GetKeys()[0].Compile();
var keyValue = new MemberExpression(keysExpr, "value");
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 20, 2024
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. Provisioning labels Nov 20, 2024
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Provisioning
Projects
None yet
Development

No branches or pull requests

3 participants