Skip to content

Commit e14e287

Browse files
gautamdshethGautam Sheth
andauthored
Fix #4501: bug fix of the cmdlets (#4580)
Co-authored-by: Gautam Sheth <gautam.sheth@staffbase.com>
1 parent 15e04a7 commit e14e287

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ ClientBin/
170170
*.dbmdl
171171
*.dbproj.schemaview
172172
*.pfx
173+
*.cer
173174
*.publishsettings
174175
node_modules/
175176
orleans.codegen.cs

src/Commands/Apps/AddAzureADServicePrincipalAppRole.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
using System.Management.Automation;
21
using PnP.PowerShell.Commands.Attributes;
32
using PnP.PowerShell.Commands.Base;
43
using PnP.PowerShell.Commands.Base.PipeBinds;
54
using PnP.PowerShell.Commands.Enums;
65
using PnP.PowerShell.Commands.Model.AzureAD;
76
using PnP.PowerShell.Commands.Utilities;
7+
using System.Management.Automation;
88

99
namespace PnP.PowerShell.Commands.Apps
1010
{
1111
[Cmdlet(VerbsCommon.Add, "PnPAzureADServicePrincipalAppRole")]
12-
[RequiredApiApplicationPermissions("graph/AppRoleAssignment.ReadWrite.All", "Application.Read.All")]
12+
[RequiredApiDelegatedOrApplicationPermissions("graph/AppRoleAssignment.ReadWrite.All")]
13+
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.Read.All")]
14+
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.ReadWrite.All")]
1315
[Alias("Add-PnPEntraIDServicePrincipalAppRole")]
1416
public class AddAzureADServicePrincipalAppRole : PnPGraphCmdlet
1517
{
@@ -30,13 +32,13 @@ public class AddAzureADServicePrincipalAppRole : PnPGraphCmdlet
3032
public ServicePrincipalPipeBind Resource;
3133

3234
[Parameter(Mandatory = true, ParameterSetName = ParameterSet_BYBUILTINTYPE)]
33-
public ServicePrincipalBuiltInType BuiltInType;
35+
public ServicePrincipalBuiltInType BuiltInType;
3436

3537
protected override void ExecuteCmdlet()
3638
{
3739
var principal = Principal.GetServicePrincipal(this, Connection, AccessToken);
3840

39-
if(principal == null)
41+
if (principal == null)
4042
{
4143
throw new PSArgumentException("Service principal not found", nameof(Principal));
4244
}
@@ -59,8 +61,8 @@ protected override void ExecuteCmdlet()
5961
{
6062
appRole = AppRole.AppRole;
6163
}
62-
63-
if(appRole == null)
64+
65+
if (appRole == null)
6466
{
6567
throw new PSArgumentException("AppRole not found", nameof(AppRole));
6668
}

src/Commands/Apps/GetAzureADServicePrincipal.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Management.Automation;
41
using PnP.PowerShell.Commands.Attributes;
52
using PnP.PowerShell.Commands.Base;
63
using PnP.PowerShell.Commands.Enums;
74
using PnP.PowerShell.Commands.Model.AzureAD;
85
using PnP.PowerShell.Commands.Utilities;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Management.Automation;
99

1010
namespace PnP.PowerShell.Commands.Apps
1111
{
1212
[Cmdlet(VerbsCommon.Get, "PnPAzureADServicePrincipal", DefaultParameterSetName = ParameterSet_ALL)]
13-
[RequiredApiApplicationPermissions("graph/Application.Read.All")]
13+
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.Read.All")]
14+
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.ReadWrite.All")]
1415
[OutputType(typeof(List<AzureADServicePrincipal>))]
1516
[Alias("Get-PnPEntraIDServicePrincipal")]
1617
public class GetAzureADServicePrincipal : PnPGraphCmdlet

0 commit comments

Comments
 (0)