Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ ClientBin/
*.dbmdl
*.dbproj.schemaview
*.pfx
*.cer
*.publishsettings
node_modules/
orleans.codegen.cs
Expand Down
14 changes: 8 additions & 6 deletions src/Commands/Apps/AddAzureADServicePrincipalAppRole.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using System.Management.Automation;
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Base.PipeBinds;
using PnP.PowerShell.Commands.Enums;
using PnP.PowerShell.Commands.Model.AzureAD;
using PnP.PowerShell.Commands.Utilities;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsCommon.Add, "PnPAzureADServicePrincipalAppRole")]
[RequiredApiApplicationPermissions("graph/AppRoleAssignment.ReadWrite.All", "Application.Read.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/AppRoleAssignment.ReadWrite.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.Read.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.ReadWrite.All")]
[Alias("Add-PnPEntraIDServicePrincipalAppRole")]
public class AddAzureADServicePrincipalAppRole : PnPGraphCmdlet
{
Expand All @@ -30,13 +32,13 @@ public class AddAzureADServicePrincipalAppRole : PnPGraphCmdlet
public ServicePrincipalPipeBind Resource;

[Parameter(Mandatory = true, ParameterSetName = ParameterSet_BYBUILTINTYPE)]
public ServicePrincipalBuiltInType BuiltInType;
public ServicePrincipalBuiltInType BuiltInType;

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

if(principal == null)
if (principal == null)
{
throw new PSArgumentException("Service principal not found", nameof(Principal));
}
Expand All @@ -59,8 +61,8 @@ protected override void ExecuteCmdlet()
{
appRole = AppRole.AppRole;
}
if(appRole == null)

if (appRole == null)
{
throw new PSArgumentException("AppRole not found", nameof(AppRole));
}
Expand Down
9 changes: 5 additions & 4 deletions src/Commands/Apps/GetAzureADServicePrincipal.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
using System.Management.Automation;
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Enums;
using PnP.PowerShell.Commands.Model.AzureAD;
using PnP.PowerShell.Commands.Utilities;
using System;
using System.Collections.Generic;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsCommon.Get, "PnPAzureADServicePrincipal", DefaultParameterSetName = ParameterSet_ALL)]
[RequiredApiApplicationPermissions("graph/Application.Read.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.Read.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Application.ReadWrite.All")]
[OutputType(typeof(List<AzureADServicePrincipal>))]
[Alias("Get-PnPEntraIDServicePrincipal")]
public class GetAzureADServicePrincipal : PnPGraphCmdlet
Expand Down
Loading