azure-sdk-for-net: [BUG] CreateOrUpdate on VaultResource deletes all AccessPolicies

Library name and version

Azure.ResourceManager.KeyVault 1.0.0

Describe the bug

CreateOrUpdate on a existing KeyVault deletes all existing AccessPolicies. I think the root case is this MR #28678, where the AccessPolicy list is set to a new list explicitly in the ctor.

Expected behavior

CreateOrUpdate should only updates the KeyVault properties and not delete all Access Policies.

Actual behavior

CreateOrUpdate deletes all Access Policies just by updating the Tags for examples.

Reproduction Steps

  1. Create KeyVault
  2. Assign Access Policy
  3. CreateOrUpdate on the KeyVault with exsting AccessPolices

Result: Access Polices are gone.

Environment

.NET SDK: Version: 7.0.100 Commit: e12b7af219

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.100\

Host: Version: 7.0.0 Architecture: x64 Commit: d099f075e4

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@mcgallan What exactly has been fixed? Will the AccessPolicies now been preserved? Or are they mandatory?

Now you can use CreateOrUpdate() to update the properties(such as tags) without deleting Access Policies in the new version