Skip to content

Commit efe9e19

Browse files
authored
fix 13687 (Azure#13778)
1 parent 9bb2a9a commit efe9e19

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/KeyVault/KeyVault/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21-
* Added a new parameter `-AsPlainText` to `Get-AzKeyVaultSecret` to directly return the secret in plain text
21+
* Added a new parameter `-AsPlainText` to `Get-AzKeyVaultSecret` to directly return the secret in plain text [#13630]
2222
* Supported selective restore a key from a managed HSM full backup [#13526]
2323
* Added missing return objects of `Get-Secret` in SecretManagement module
24+
* Fixed an issue that may cause vault to be created without default access policy [#13687]
2425

2526
## Version 3.2.0
2627
* Supported "all" as an option when setting key vault access policies

src/KeyVault/KeyVault/Models/KeyVaultManagementCmdletBase.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
using Microsoft.Azure.Commands.ResourceManager.Common.Paging;
2121
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
2222
using Microsoft.Azure.Graph.RBAC.Version1_6.ActiveDirectory;
23+
using Graph20190326Ad = Microsoft.Azure.Graph.RBAC.Version1_6_20190326.ActiveDirectory;
24+
using Microsoft.Azure.Graph.RBAC.Version1_6_20190326;
2325
using Microsoft.Azure.Management.Internal.Resources;
2426
using Microsoft.Azure.Management.Internal.Resources.Models;
2527
using Microsoft.Azure.Management.Internal.Resources.Utilities;
@@ -234,14 +236,9 @@ protected string GetCurrentUsersObjectId()
234236
string objectId = null;
235237
if (DefaultContext.Account.Type == AzureAccount.AccountType.User)
236238
{
237-
// TODO: Remove IfDef
238-
#if NETSTANDARD
239-
objectId = ActiveDirectoryClient.GetObjectId(new ADObjectFilterOptions { UPN = DefaultContext.Account.Id }).ToString();
240-
#else
241-
var userFetcher = ActiveDirectoryClient.Me.ToUser();
242-
var user = userFetcher.ExecuteAsync().Result;
243-
objectId = user.ObjectId;
244-
#endif
239+
var adClient = new Graph20190326Ad.ActiveDirectoryClient(DefaultProfile.DefaultContext);
240+
// this operation is only in 20190326 version of API
241+
objectId = adClient.GraphClient.SignedInUser.Get()?.ObjectId;
245242
}
246243

247244
return objectId;

0 commit comments

Comments
 (0)