-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[QUERY] How do I programmatically set-up storage account access keys for auto rotation in key vault? #20941
Comments
This need both storage SDK and key vault SDK. For storage SDK side: first you will need assign an identity to the storage account, and get the account identity ID, like following. var updateParameters = new StorageAccountUpdateParameters()
{
Identity = new Identity() { Type = IdentityType.SystemAssigned }
};
account = storageMgmtClient.StorageAccounts.Update(rgname, accountName, updateParameters);
string accountId = account.Identity.PrincipalId; Then you need give the Finally, you can update the keyvault key information to the storage account. As you need enabled key auto rotation, just skip set key version. updateParameters = new StorageAccountUpdateParameters
{
Encryption = new Encryption
{
Services = new EncryptionServices { Blob = new EncryptionService { Enabled = true }, File = new EncryptionService { Enabled = true } },
KeySource = "Microsoft.Keyvault",
KeyVaultProperties =
new KeyVaultProperties
{
KeyName = keyVaultKey.KeyIdentifier.Name,
KeyVaultUri = keyVault.Properties.VaultUri
}
}
};
account = storageMgmtClient.StorageAccounts.Update(rgname, accountName, updateParameters); For you reference, this is a sample to enable CMK in Powershell: https://docs.microsoft.com/en-us/azure/storage/common/customer-managed-keys-configure-key-vault?tabs=powershell |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @RandalliLama, @schaabs, @jlichwa. Issue DetailsQuery/Question
I am developing in C# and have managed to accomplish (1) and (2) but not getting any help in docs for (3) and (4). Could you please point me in the right direction? Environment:
|
@aniruddhagore1984 if you are looking for managed storage account keys feature, here is the sample in .NET https://docs.microsoft.com/en-us/samples/azure/azure-sdk-for-net/share-link/ This feature does not add storage account key to key vault, just use Key Vault to manage access by generating storage account keys SAS tokens, more can be find here: Other than that when direct access to keys is required, key vault does not provide any built in way to rotate access keys in key vault besides using function like here: |
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Query/Question
I intend to accomplish the following:
I am developing in C# and have managed to accomplish (1) and (2) but not getting any help in docs for (3) and (4). Could you please point me in the right direction?
Environment:
dotnet --info
output for .NET Core projects): Windows 10 .NET FrameworkThe text was updated successfully, but these errors were encountered: