Skip to content

Commit

Permalink
New Commands - Add-PnPFlowOwner & Remove-PnPFlowOwner
Browse files Browse the repository at this point in the history
  • Loading branch information
NishkalankBezawada committed Aug 9, 2023
1 parent 53e7af0 commit 5167458
Show file tree
Hide file tree
Showing 5 changed files with 485 additions and 0 deletions.
140 changes: 140 additions & 0 deletions documentation/Add-PnPFlowOwner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Add-PnPFlowOwner.html
external help file: PnP.PowerShell.dll-Help.xml
title: Add-PnPFlowOwner
---

# Add-PnPFlowOwner

## SYNOPSIS

**Required Permissions**

* Azure: management.azure.com

Assigns/updates permissions to a Power Automate flow

## SYNTAX

### By Identity and User (default)
```powershell
Add-PnPFlowOwner [-Environment <PowerAutomateEnvironmentPipeBind>] [-Identity <PowerPlatformPipeBind>] [-User <String>] [-AsAdmin] [-RoleName <FlowUserRoleName>]
```


## DESCRIPTION
This cmdlet assigns/updates permissions for a user to a power automate flow.

## EXAMPLES

### Example 1
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Add-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User username@tenant.onmicrosoft.com -RoleName CanEdit
```
Assigns the specified useremail with 'CanEdit' access level to the specified flow

### Example 2
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Add-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User 6844c04a-8ee7-40ad-af66-28f6e948cd04 -RoleName CanView
```
Assigns the specified user id with 'CanView' access level to the specified flow

### Example 3
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Add-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User 6844c04a-8ee7-40ad-af66-28f6e948cd04 -RoleName CanViewWithShare
```
Assigns the specified user id with 'CanViewWithShare' access level to the specified flow

### Example 4
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Add-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User username@tenant.onmicrosoft.com -AsAdmin -RoleName CanEdit
```
Assigns the specified useremail with 'CanEdit' access level to the specified flow as admin

## PARAMETERS

### -Environment
The name of the Power Platform environment or an Environment object to retrieve the available flows for.

```yaml
Type: PowerAutomateEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: The default environment
Accept pipeline input: False
Accept wildcard characters: False
```

### -Identity
The Name/Id of the flow to retrieve.

```yaml
Type: PowerPlatformPipeBind
Parameter Sets: By Identity
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -User
Returns the user with the provided user id or username.

```yaml
Type: String
Parameter Sets: Return by specific ID/UserName

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RoleName
Allows specifying the type of access levels with which user should be added to the flow . Valid values: CanView, CanViewWithShare, CanEdit.

```yaml
Type: FlowUserRoleName
Parameter Sets: All

Required: True
Position: Named
Default value: All
Accept pipeline input: False
Accept wildcard characters: False
```



### -AsAdmin
If specified returns all the flows as admin. If not specified only the flows for the current user will be returned.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
141 changes: 141 additions & 0 deletions documentation/Remove-PnPFlowOwner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPFlowOwner.html
external help file: PnP.PowerShell.dll-Help.xml
title: Remove-PnPFlowOwner
---

# Remove-PnPFlowOwner

## SYNOPSIS

**Required Permissions**

* Azure: management.azure.com

Removes owner permissions to a Power Automate flow


## SYNTAX

### By Identity and User (default)
```powershell
Remove-PnPFlowOwner [-Environment <PowerAutomateEnvironmentPipeBind>] [-Identity <PowerPlatformPipeBind>] [-User <String>] [-AsAdmin] [-Force]
```


## DESCRIPTION
This cmdlet removes owner permissions for a user to a power automate flow.

## EXAMPLES

### Example 1
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Remove-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User username@tenant.onmicrosoft.com
```
Removes the specified user email with owner access level to the specified flow

### Example 2
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Remove-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User 6844c04a-8ee7-40ad-af66-28f6e948cd04
```
Removes the specified user id with owner access level to the specified flow

### Example 3
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Remove-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User username@tenant.onmicrosoft.com -AsAdmin
```
Removes the specified user email with owner access level to the specified flow as admin

### Example 4
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Remove-PnPFlowOwner -environment $environment -Identity f07c34a9-a586-4e58-91fb-e7ea19741b61 -User username@tenant.onmicrosoft.com -AsAdmin -Force
```
Removes the specified user email with owner access level to the specified flow as admin, without confirmation

## PARAMETERS

### -Environment
The name of the Power Platform environment or an Environment object to retrieve the available flows for.

```yaml
Type: PowerAutomateEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: The default environment
Accept pipeline input: False
Accept wildcard characters: False
```

### -Identity
The Name/Id of the flow to retrieve.

```yaml
Type: PowerPlatformPipeBind
Parameter Sets: By Identity
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -User
Returns the user with the provided user id or username.

```yaml
Type: String
Parameter Sets: Return by specific ID/UserName

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```


### -AsAdmin
If specified returns all the flows as admin. If not specified only the flows for the current user will be returned.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Force
Specifying the Force parameter will skip the confirmation question.

```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```


## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
23 changes: 23 additions & 0 deletions src/Commands/Enums/FlowUserRoleName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace PnP.PowerShell.Commands.Enums
{
/// <summary>
/// Scopes to which Access level for the user on the flow.
/// </summary>
public enum FlowUserRoleName
{
/// <summary>
/// sets the view access level on the flow for the user/group
/// </summary>
CanView,

/// <summary>
/// sets the view with share access level on the flow for the user/group
/// </summary>
CanViewWithShare,

/// <summary>
/// sets the edit access level on the flow for the user/group
/// </summary>
CanEdit,
}
}
Loading

0 comments on commit 5167458

Please sign in to comment.