|
| 1 | +--- |
| 2 | +external help file: |
| 3 | +Module Name: Az.Resources |
| 4 | +online version: https://learn.microsoft.com/powershell/module/az.resources/add-azadapppermission |
| 5 | +schema: 2.0.0 |
| 6 | +--- |
| 7 | + |
| 8 | +# Add-AzADAppPermission |
| 9 | + |
| 10 | +## SYNOPSIS |
| 11 | +Adds an API permission. |
| 12 | + |
| 13 | +## SYNTAX |
| 14 | + |
| 15 | +### ObjectIdParameterSet (Default) |
| 16 | +``` |
| 17 | +Add-AzADAppPermission -ApiId <Guid> -ObjectId <Guid> -PermissionId <String> [-Type <String>] |
| 18 | + [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>] |
| 19 | +``` |
| 20 | + |
| 21 | +### AppIdParameterSet |
| 22 | +``` |
| 23 | +Add-AzADAppPermission -ApiId <Guid> -ApplicationId <Guid> -PermissionId <String> [-Type <String>] |
| 24 | + [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>] |
| 25 | +``` |
| 26 | + |
| 27 | +## DESCRIPTION |
| 28 | +Adds an API permission. |
| 29 | +The list of available permissions of API is property of application represented by service principal in tenant. |
| 30 | + |
| 31 | +For instance, to get available permissions for Graph API: |
| 32 | +* Azure Active Directory Graph: `Get-AzAdServicePrincipal -ApplicationId 00000002-0000-0000-c000-000000000000` |
| 33 | +* Microsoft Graph: `Get-AzAdServicePrincipal -ApplicationId 00000003-0000-0000-c000-000000000000` |
| 34 | + |
| 35 | +Application permissions under the `appRoles` property correspond to `Role` in `-Type`. |
| 36 | +Delegated permissions under the `oauth2Permissions` property correspond to `Scope` in `-Type`. |
| 37 | + |
| 38 | +User needs to grant consent via Azure Portal if the permission requires admin consent because Azure PowerShell doesn't support it yet. |
| 39 | + |
| 40 | +## EXAMPLES |
| 41 | + |
| 42 | +### Example 1: Add API Permission |
| 43 | +```powershell |
| 44 | +Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 5f8c59db-677d-491f-a6b8-5f174b11ec1d |
| 45 | +``` |
| 46 | + |
| 47 | +Add delegated permission "Group.Read.All" of Microsoft Graph API to AD Application (9cc74d5e-1162-4b90-8696-65f3d6a3f7d0) |
| 48 | + |
| 49 | +### Example 2: Add API Permission |
| 50 | +```powershell |
| 51 | +Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 1138cb37-bd11-4084-a2b7-9f71582aeddb -Type Role |
| 52 | +``` |
| 53 | + |
| 54 | +Add application permission "Device.ReadWrite.All" of Microsoft Graph API to AD Application (9cc74d5e-1162-4b90-8696-65f3d6a3f7d0) |
| 55 | + |
| 56 | +## PARAMETERS |
| 57 | + |
| 58 | +### -ApiId |
| 59 | +The unique identifier for the resource that the application requires access to. |
| 60 | +This should be equal to the appId declared on the target resource application. |
| 61 | + |
| 62 | +```yaml |
| 63 | +Type: System.Guid |
| 64 | +Parameter Sets: (All) |
| 65 | +Aliases: |
| 66 | + |
| 67 | +Required: True |
| 68 | +Position: Named |
| 69 | +Default value: None |
| 70 | +Accept pipeline input: False |
| 71 | +Accept wildcard characters: False |
| 72 | +``` |
| 73 | +
|
| 74 | +### -ApplicationId |
| 75 | +The application Id. |
| 76 | +
|
| 77 | +```yaml |
| 78 | +Type: System.Guid |
| 79 | +Parameter Sets: AppIdParameterSet |
| 80 | +Aliases: |
| 81 | + |
| 82 | +Required: True |
| 83 | +Position: Named |
| 84 | +Default value: None |
| 85 | +Accept pipeline input: False |
| 86 | +Accept wildcard characters: False |
| 87 | +``` |
| 88 | +
|
| 89 | +### -DefaultProfile |
| 90 | +The credentials, account, tenant, and subscription used for communication with Azure. |
| 91 | +
|
| 92 | +```yaml |
| 93 | +Type: System.Management.Automation.PSObject |
| 94 | +Parameter Sets: (All) |
| 95 | +Aliases: AzContext, AzureRmContext, AzureCredential |
| 96 | + |
| 97 | +Required: False |
| 98 | +Position: Named |
| 99 | +Default value: None |
| 100 | +Accept pipeline input: False |
| 101 | +Accept wildcard characters: False |
| 102 | +``` |
| 103 | +
|
| 104 | +### -ObjectId |
| 105 | +The unique identifier in Azure AD. |
| 106 | +
|
| 107 | +```yaml |
| 108 | +Type: System.Guid |
| 109 | +Parameter Sets: ObjectIdParameterSet |
| 110 | +Aliases: |
| 111 | + |
| 112 | +Required: True |
| 113 | +Position: Named |
| 114 | +Default value: None |
| 115 | +Accept pipeline input: False |
| 116 | +Accept wildcard characters: False |
| 117 | +``` |
| 118 | +
|
| 119 | +### -PermissionId |
| 120 | +The unique identifier for one of the oauth2PermissionScopes or appRole instances that the resource application exposes. |
| 121 | +
|
| 122 | +```yaml |
| 123 | +Type: System.String |
| 124 | +Parameter Sets: (All) |
| 125 | +Aliases: |
| 126 | + |
| 127 | +Required: True |
| 128 | +Position: Named |
| 129 | +Default value: None |
| 130 | +Accept pipeline input: False |
| 131 | +Accept wildcard characters: False |
| 132 | +``` |
| 133 | +
|
| 134 | +### -Type |
| 135 | +Specifies whether the id property references an oauth2PermissionScopes(Scope, delegated permission) or an appRole(Role, application permission). |
| 136 | +
|
| 137 | +```yaml |
| 138 | +Type: System.String |
| 139 | +Parameter Sets: (All) |
| 140 | +Aliases: |
| 141 | + |
| 142 | +Required: False |
| 143 | +Position: Named |
| 144 | +Default value: None |
| 145 | +Accept pipeline input: False |
| 146 | +Accept wildcard characters: False |
| 147 | +``` |
| 148 | +
|
| 149 | +### -Confirm |
| 150 | +Prompts you for confirmation before running the cmdlet. |
| 151 | +
|
| 152 | +```yaml |
| 153 | +Type: System.Management.Automation.SwitchParameter |
| 154 | +Parameter Sets: (All) |
| 155 | +Aliases: cf |
| 156 | + |
| 157 | +Required: False |
| 158 | +Position: Named |
| 159 | +Default value: None |
| 160 | +Accept pipeline input: False |
| 161 | +Accept wildcard characters: False |
| 162 | +``` |
| 163 | +
|
| 164 | +### -WhatIf |
| 165 | +Shows what would happen if the cmdlet runs. |
| 166 | +The cmdlet is not run. |
| 167 | +
|
| 168 | +```yaml |
| 169 | +Type: System.Management.Automation.SwitchParameter |
| 170 | +Parameter Sets: (All) |
| 171 | +Aliases: wi |
| 172 | + |
| 173 | +Required: False |
| 174 | +Position: Named |
| 175 | +Default value: None |
| 176 | +Accept pipeline input: False |
| 177 | +Accept wildcard characters: False |
| 178 | +``` |
| 179 | +
|
| 180 | +### CommonParameters |
| 181 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 182 | +
|
| 183 | +## INPUTS |
| 184 | +
|
| 185 | +## OUTPUTS |
| 186 | +
|
| 187 | +### System.Boolean |
| 188 | +
|
| 189 | +## NOTES |
| 190 | +
|
| 191 | +ALIASES |
| 192 | +
|
| 193 | +## RELATED LINKS |
| 194 | +
|
0 commit comments