-
Notifications
You must be signed in to change notification settings - Fork 174
Fix StorageAccountConfig.Key to return account key instead of connection string #1239
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
base: master
Are you sure you want to change the base?
Conversation
- Added StorageAccount.getAccountKey() helper methods - Added AccountKey member to StorageAccountConfig (returns just the key) - Added ConnectionString member to StorageAccountConfig (returns connection string) - Marked Key member as obsolete with descriptive message - Updated all internal usages and tests to use ConnectionString instead of Key - Updated sample scripts to use ConnectionString - Added unit tests for AccountKey and ConnectionString members - Updated RELEASE_NOTES.md Co-authored-by: ninjarobot <1520226+ninjarobot@users.noreply.github.com>
Co-authored-by: ninjarobot <1520226+ninjarobot@users.noreply.github.com>
| /// Gets an ARM Expression for the account key of any Storage Account. | ||
| static member getAccountKey(storageAccount: ResourceId) = | ||
| let expr = | ||
| $"listKeys({storageAccount.ArmExpression.Value}, '2017-10-01').keys[0].value" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a super-old API version @copilot. I don't think it's changed, and this likely still works, but stick with the same version used when deploying storage accounts. At this time, that is 2025-06-01.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use API version '2025-06-01' to match the storage account resource version. Changes applied in commit f5b2f39.
Updated listKeys API version to match the storage account resource API version (2025-06-01) in: - StorageAccount.getAccountKey helper - StorageAccount.getConnectionString helper - All related tests and test data files Co-authored-by: ninjarobot <1520226+ninjarobot@users.noreply.github.com>
This PR closes #
The changes in this PR are as follows:
AccountKeymember returning just the storage account key vialistKeys(...).keys[0].valueConnectionStringmember explicitly returning the full connection stringKeymember as obsolete - it incorrectly returned a connection string despite its name suggesting it returns just the key.Keyto.ConnectionString2017-10-01to2025-06-01to match the current storage account resource API versionI have read the contributing guidelines and have completed the following:
If I haven't completed any of the tasks above, I include the reasons why here:
Did not test against live Azure subscription - changes are purely syntactic (adding new members and deprecating existing one). The obsolete member maintains identical behavior for backward compatibility.
Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.