diff --git a/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 b/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 index 852b678d2268..049f6a5a71c8 100644 --- a/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 +++ b/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 @@ -11,7 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.MSGraph.private.dll' FormatsToProcess = './Az.MSGraph.format.ps1xml' - FunctionsToExport = 'Add-AzADAppPermission', 'Add-AzADGroupMember', 'Get-AzADAppCredential', 'Get-AzADAppFederatedCredential', 'Get-AzADApplication', 'Get-AzADAppPermission', 'Get-AzADGroup', 'Get-AzADGroupMember', 'Get-AzADOrganization', 'Get-AzADServicePrincipal', 'Get-AzADSpCredential', 'Get-AzADUser', 'New-AzADAppCredential', 'New-AzADAppFederatedCredential', 'New-AzADApplication', 'New-AzADGroup', 'New-AzADServicePrincipal', 'New-AzADSpCredential', 'New-AzADUser', 'Remove-AzADAppCredential', 'Remove-AzADAppFederatedCredential', 'Remove-AzADApplication', 'Remove-AzADAppPermission', 'Remove-AzADGroup', 'Remove-AzADGroupMember', 'Remove-AzADServicePrincipal', 'Remove-AzADSpCredential', 'Remove-AzADUser', 'Update-AzADAppFederatedCredential', 'Update-AzADApplication', 'Update-AzADGroup', 'Update-AzADServicePrincipal', 'Update-AzADUser', '*' + FunctionsToExport = 'Add-AzADAppPermission', 'Add-AzADGroupMember', 'Get-AzADAppCredential', 'Get-AzADAppFederatedCredential', 'Get-AzADApplication', 'Get-AzADAppPermission', 'Get-AzADGroup', 'Get-AzADGroupMember', 'Get-AzADGroupOwner', 'Get-AzADOrganization', 'Get-AzADServicePrincipal', 'Get-AzADServicePrincipalAppRoleAssignment', 'Get-AzADSpCredential', 'Get-AzADUser', 'New-AzADAppCredential', 'New-AzADAppFederatedCredential', 'New-AzADApplication', 'New-AzADGroup', 'New-AzADGroupOwner', 'New-AzADServicePrincipal', 'New-AzADServicePrincipalAppRoleAssignment', 'New-AzADSpCredential', 'New-AzADUser', 'Remove-AzADAppCredential', 'Remove-AzADAppFederatedCredential', 'Remove-AzADApplication', 'Remove-AzADAppPermission', 'Remove-AzADGroup', 'Remove-AzADGroupMember', 'Remove-AzADGroupOwner', 'Remove-AzADServicePrincipal', 'Remove-AzADServicePrincipalAppRoleAssignment', 'Remove-AzADSpCredential', 'Remove-AzADUser', 'Update-AzADAppFederatedCredential', 'Update-AzADApplication', 'Update-AzADGroup', 'Update-AzADServicePrincipal', 'Update-AzADServicePrincipalAppRoleAssignment', 'Update-AzADUser', '*' AliasesToExport = 'Get-AzADServicePrincipalCredential', 'New-AzADServicePrincipalCredential', 'Remove-AzADServicePrincipalCredential', 'Set-AzADApplication', 'Set-AzADServicePrincipal', 'Set-AzADUser', '*' PrivateData = @{ PSData = @{ diff --git a/src/Resources/MSGraph.Autorest/README.md b/src/Resources/MSGraph.Autorest/README.md index 644b1ab781e7..8650fa50c6e9 100644 --- a/src/Resources/MSGraph.Autorest/README.md +++ b/src/Resources/MSGraph.Autorest/README.md @@ -78,7 +78,6 @@ exclude-tableview-properties: [] inlining-threshold: 200 - directive: - no-inline: - MicrosoftGraphUser @@ -196,6 +195,33 @@ directive: set: property-name: Items + - where: + subject: serviceprincipalapproleassignment$ + verb: New + hide: true + + - where: + subject: serviceprincipalapproleassignment$ + parameter-name: ^DeletedDateTime$ + hide: true + + - where: + verb: Update + subject: serviceprincipalapproleassignment$ + parameter-name: ^PrincipalId$|^DisplayName$|^ResourceDisplayName$|^ResourceId$ + hide: true + + - where: + model-name: MicrosoftGraphAppRoleAssignment + set: + format-table: + properties: + - Id + - AppRoleId + - PrincipalDisplayName + - PrincipalId + - CreatedDateTime + - where: subject: application$|applicationpassword$|applicationkey$|serviceprincipal$|serviceprincipalpassword$|serviceprincipalkey$|groupmember$|user$|GroupGraphRefMember$|grouprefmember$ hide: true diff --git a/src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipalAppRoleAssignment.ps1 b/src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipalAppRoleAssignment.ps1 new file mode 100644 index 000000000000..e21ebdba9a44 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipalAppRoleAssignment.ps1 @@ -0,0 +1,185 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create new navigation property to appRoleAssignments for servicePrincipals +.Description +Create new navigation property to appRoleAssignments for servicePrincipals +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +BODY : Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types. + [(Any) ]: This indicates any property can be added to this object. + [DeletedDateTime ]: + [DisplayName ]: The name displayed in directory + [AppRoleId ]: The identifier (id) for the app role which is assigned to the principal. This app role must be exposed in the appRoles property on the resource application's service principal (resourceId). If the resource application has not declared any app roles, a default app role ID of 00000000-0000-0000-0000-000000000000 can be specified to signal that the principal is assigned to the resource app without any specific app roles. Required on create. + [PrincipalId ]: The unique identifier (id) for the user, group or service principal being granted the app role. Required on create. + [ResourceDisplayName ]: The display name of the resource app's service principal to which the assignment is made. + [ResourceId ]: The unique identifier (id) for the resource service principal for which the assignment is made. Required on create. Supports $filter (eq only). +.Link +https://learn.microsoft.com/powershell/module/az.resources/new-azadserviceprincipalapproleassignment +#> +function New-AzADServicePrincipalAppRoleAssignment { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment])] +[CmdletBinding(DefaultParameterSetName='ObjectIdWithResourceIdParameterSet', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName = 'ObjectIdWithResourceIdParameterSet', Mandatory)] + [Parameter(ParameterSetName = 'ObjectIdWithResourceDisplayNameParameterSet', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Path')] + [System.String] + # The unique identifier (id) for the user, group or service principal being granted the app role. + # Required on create. + ${ServicePrincipalId}, + + [Parameter(ParameterSetName = 'SPNWithResourceIdParameterSet', Mandatory)] + [Parameter(ParameterSetName = 'SPNWithResourceDisplayNameParameterSet', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.String] + # The name displayed in directory + ${ServicePrincipalDisplayName}, + + [Parameter()] # ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.Collections.Hashtable] + # Additional Parameters + ${AdditionalProperties}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.String] + # The identifier (id) for the app role which is assigned to the principal. + # This app role must be exposed in the appRoles property on the resource application's service principal (resourceId). + # If the resource application has not declared any app roles, a default app role ID of 00000000-0000-0000-0000-000000000000 can be specified to signal that the principal is assigned to the resource app without any specific app roles. + # Required on create. + ${AppRoleId}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.DateTime] + # . + ${DeletedDateTime}, + + [Parameter(ParameterSetName = 'ObjectIdWithResourceIdParameterSet', Mandatory)] + [Parameter(ParameterSetName = 'SPNWithResourceIdParameterSet', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.String] + # The unique identifier (id) for the resource service principal for which the assignment is made. + # Required on create. + # Supports $filter (eq only). + ${ResourceId}, + + [Parameter(ParameterSetName = 'ObjectIdWithResourceDisplayNameParameterSet', Mandatory)] + [Parameter(ParameterSetName = 'SPNWithResourceDisplayNameParameterSet', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')] + [System.String] + # The display name of the resource app's service principal to which the assignment is made. + ${ResourceDisplayName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + switch ($PSCmdlet.ParameterSetName) { + {($_ -eq 'SPNWithResourceIdParameterSet') -or ($_ -eq 'SPNWithResourceDisplayNameParameterSet')}{ + if ($PSBoundParameters['ServicePrincipalDisplayName']) { + $PSBoundParameters['DisplayName'] = $PSBoundParameters['ServicePrincipalDisplayName'] + $null = $PSBoundParameters.Remove('ServicePrincipalDisplayName') + + $sp = Get-AzADServicePrincipal -DisplayName $PSBoundParameters['DisplayName'] + if($null -eq $sp) { + Write-Error "Cannot find service principal by DisplayName $($PSBoundParameters['DisplayName'])" + } + + $PSBoundParameters['ServicePrincipalId'] = $sp.Id + } + } + + {($_ -eq 'SPNWithResourceDisplayNameParameterSet') -or ($_ -eq 'ObjectIdWithResourceDisplayNameParameterSet')} { + if ($PSBoundParameters['ResourceDisplayName']) { + $sp = Get-AzADServicePrincipal -DisplayName $PSBoundParameters['ResourceDisplayName'] + if($null -eq $sp) { + Write-Error "Cannot find resource service principal by ResourceDisplayName $($PSBoundParameters['ResourceDisplayName'])" + } + + $PSBoundParameters['ResourceId'] = $sp.Id + } + } + } + + $PSBoundParameters['PrincipalId'] = $PSBoundParameters['ServicePrincipalId'] + + . Az.MSGraph.internal\New-AzADServicePrincipalAppRoleAssignment @PSBoundParameters + } + +} + diff --git a/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md b/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md index 2f2ef487994b..3e22ebb7c197 100644 --- a/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md +++ b/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md @@ -50,6 +50,9 @@ Retrieve a list of organization objects. ### [Get-AzADServicePrincipal](Get-AzADServicePrincipal.md) Lists entities from service principals or get entity from service principals by key +### [Get-AzADServicePrincipalAppRoleAssignment](Get-AzADServicePrincipalAppRoleAssignment.md) +Get appRoleAssignments from servicePrincipals + ### [Get-AzADSpCredential](Get-AzADSpCredential.md) Lists key credentials and password credentials for an service principal. @@ -74,6 +77,9 @@ Create new navigation property ref to owners for groups ### [New-AzADServicePrincipal](New-AzADServicePrincipal.md) Adds new entity to servicePrincipals +### [New-AzADServicePrincipalAppRoleAssignment](New-AzADServicePrincipalAppRoleAssignment.md) +Create new navigation property to appRoleAssignments for servicePrincipals + ### [New-AzADSpCredential](New-AzADSpCredential.md) Creates key credentials or password credentials for an service principal. @@ -108,6 +114,9 @@ Delete ref of navigation property owners for groups ### [Remove-AzADServicePrincipal](Remove-AzADServicePrincipal.md) Deletes entity from service principal. +### [Remove-AzADServicePrincipalAppRoleAssignment](Remove-AzADServicePrincipalAppRoleAssignment.md) +Delete navigation property appRoleAssignments for servicePrincipals + ### [Remove-AzADSpCredential](Remove-AzADSpCredential.md) Removes key credentials or password credentials for an service principal. @@ -126,6 +135,9 @@ Update entity in groups ### [Update-AzADServicePrincipal](Update-AzADServicePrincipal.md) Updates entity in service principal +### [Update-AzADServicePrincipalAppRoleAssignment](Update-AzADServicePrincipalAppRoleAssignment.md) +Update the navigation property appRoleAssignments in servicePrincipals + ### [Update-AzADUser](Update-AzADUser.md) Updates entity in users diff --git a/src/Resources/MSGraph.Autorest/docs/Get-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/docs/Get-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..d0ed05b49f89 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/docs/Get-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.Resources +online version: https://learn.microsoft.com/powershell/module/az.resources/get-azadserviceprincipalapproleassignment +schema: 2.0.0 +--- + +# Get-AzADServicePrincipalAppRoleAssignment + +## SYNOPSIS +Get appRoleAssignments from servicePrincipals + +## SYNTAX + +### List (Default) +``` +Get-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId [-Count] [-Expand ] + [-Filter ] [-Orderby ] [-Search ] [-Select ] [-First ] + [-Skip ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId -ServicePrincipalId + [-Expand ] [-Select ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Get appRoleAssignments from servicePrincipals + +## EXAMPLES + +### Example 1: List assigned app roles +```powershell +Get-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +Zbm-cUeDXUmlicIc3eenIhHyPMkzw2VEh76fTc0bGtM e799a9e2-acac-4960-9ba0-6a17661fa16a funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 6:56:52 AM +``` + +List assigned app roles. + +### Example 2: Get by AppRoleAssignmentId +```powershell +Get-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +``` + +Get an assigned app role by Id. + +## PARAMETERS + +### -AppRoleAssignmentId +key: id of appRoleAssignment + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Count +Include count of items + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Expand +Expand related entities + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +Filter items by property values + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -First +Gets only the first 'n' objects. + +```yaml +Type: System.UInt64 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Orderby +Order items by property values + +```yaml +Type: System.String[] +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Search +Search items by search phrases + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Select +Select properties to be returned + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServicePrincipalId +key: id of servicePrincipal + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Skip +Ignores the first 'n' objects and then gets the remaining objects. + +```yaml +Type: System.UInt64 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +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). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Resources/MSGraph.Autorest/docs/New-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/docs/New-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..7e4dcf80407d --- /dev/null +++ b/src/Resources/MSGraph.Autorest/docs/New-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.Resources +online version: https://learn.microsoft.com/powershell/module/az.resources/new-azadserviceprincipalapproleassignment +schema: 2.0.0 +--- + +# New-AzADServicePrincipalAppRoleAssignment + +## SYNOPSIS +Create new navigation property to appRoleAssignments for servicePrincipals + +## SYNTAX + +### ObjectIdWithResourceIdParameterSet (Default) +``` +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId -ResourceId + [-AdditionalProperties ] [-AppRoleId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### ObjectIdWithResourceDisplayNameParameterSet +``` +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId -ResourceDisplayName + [-AdditionalProperties ] [-AppRoleId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### SPNWithResourceDisplayNameParameterSet +``` +New-AzADServicePrincipalAppRoleAssignment -ResourceDisplayName -ServicePrincipalDisplayName + [-AdditionalProperties ] [-AppRoleId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### SPNWithResourceIdParameterSet +``` +New-AzADServicePrincipalAppRoleAssignment -ResourceId -ServicePrincipalDisplayName + [-AdditionalProperties ] [-AppRoleId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Create new navigation property to appRoleAssignments for servicePrincipals + +## EXAMPLES + +### Example 1: ObjectIdWithResourceIdParameterSet +```powershell +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -ResourceId 351fa797-c81a-4998-9720-4c2ecb6c7abc -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +``` + +Create an appRoleAssignment using ServicePrincipalId and ResourceId. + +### Example 2: SPNWithResourceDisplayNameParameterSet +```powershell +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalDisplayName funapp1214 -ResourceDisplayName nori-sp -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIlqgWRlWp2hFrXIJiqP2j78 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:07:16 AM +``` + +Create an appRoleAssignment for service principal using ServicePrincipal DisplayName and Resource DisplayName. + +## PARAMETERS + +### -AdditionalProperties +ParameterSetName='CreateExpanded')] +Additional Parameters + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AppRoleId +The identifier (id) for the app role which is assigned to the principal. +This app role must be exposed in the appRoles property on the resource application's service principal (resourceId). +If the resource application has not declared any app roles, a default app role ID of 00000000-0000-0000-0000-000000000000 can be specified to signal that the principal is assigned to the resource app without any specific app roles. +Required on create. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceDisplayName +The display name of the resource app's service principal to which the assignment is made. + +```yaml +Type: System.String +Parameter Sets: ObjectIdWithResourceDisplayNameParameterSet, SPNWithResourceDisplayNameParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The unique identifier (id) for the resource service principal for which the assignment is made. +Required on create. +Supports $filter (eq only). + +```yaml +Type: System.String +Parameter Sets: ObjectIdWithResourceIdParameterSet, SPNWithResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServicePrincipalDisplayName +The name displayed in directory + +```yaml +Type: System.String +Parameter Sets: SPNWithResourceDisplayNameParameterSet, SPNWithResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServicePrincipalId +The unique identifier (id) for the user, group or service principal being granted the app role. +Required on create. + +```yaml +Type: System.String +Parameter Sets: ObjectIdWithResourceDisplayNameParameterSet, ObjectIdWithResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +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). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Resources/MSGraph.Autorest/docs/Remove-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/docs/Remove-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..c7a4db5db2f0 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/docs/Remove-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,154 @@ +--- +external help file: +Module Name: Az.Resources +online version: https://learn.microsoft.com/powershell/module/az.resources/remove-azadserviceprincipalapproleassignment +schema: 2.0.0 +--- + +# Remove-AzADServicePrincipalAppRoleAssignment + +## SYNOPSIS +Delete navigation property appRoleAssignments for servicePrincipals + +## SYNTAX + +``` +Remove-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId -ServicePrincipalId + [-IfMatch ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete navigation property appRoleAssignments for servicePrincipals + +## EXAMPLES + +### Example 1: Remove an app role from service principal +```powershell +Remove-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIlTWN1A5UVFMigS0D3ED-dk -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 +``` + +Remove an app role from service principal. + +## PARAMETERS + +### -AppRoleAssignmentId +key: id of appRoleAssignment + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfMatch +ETag + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServicePrincipalId +key: id of servicePrincipal + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +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). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Resources/MSGraph.Autorest/docs/Update-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/docs/Update-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..7ad7e2e1d167 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/docs/Update-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,214 @@ +--- +external help file: +Module Name: Az.Resources +online version: https://learn.microsoft.com/powershell/module/az.resources/update-azadserviceprincipalapproleassignment +schema: 2.0.0 +--- + +# Update-AzADServicePrincipalAppRoleAssignment + +## SYNOPSIS +Update the navigation property appRoleAssignments in servicePrincipals + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId -ServicePrincipalId + [-AdditionalProperties ] [-AppRoleId ] [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### Update +``` +Update-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId -ServicePrincipalId + -Body [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Update the navigation property appRoleAssignments in servicePrincipals + +## EXAMPLES + +### Example 1: Update the AppRoleId +```powershell +Update-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIoFW9pZ_gRBIudKgu0gaMIw -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +Update the assigned App role id. + +## PARAMETERS + +### -AdditionalProperties +Additional Parameters + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AppRoleAssignmentId +key: id of appRoleAssignment + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AppRoleId +The identifier (id) for the app role which is assigned to the principal. +This app role must be exposed in the appRoles property on the resource application's service principal (resourceId). +If the resource application has not declared any app roles, a default app role ID of 00000000-0000-0000-0000-000000000000 can be specified to signal that the principal is assigned to the resource app without any specific app roles. +Required on create. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Body +Represents an Azure Active Directory object. +The directoryObject type is the base type for many other directory entity types. +To construct, see NOTES section for BODY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment +Parameter Sets: Update +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ServicePrincipalId +key: id of servicePrincipal + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +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). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphAppRoleAssignment + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +BODY : Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types. + - `[(Any) ]`: This indicates any property can be added to this object. + - `[DeletedDateTime ]`: + - `[DisplayName ]`: The name displayed in directory + - `[AppRoleId ]`: The identifier (id) for the app role which is assigned to the principal. This app role must be exposed in the appRoles property on the resource application's service principal (resourceId). If the resource application has not declared any app roles, a default app role ID of 00000000-0000-0000-0000-000000000000 can be specified to signal that the principal is assigned to the resource app without any specific app roles. Required on create. + - `[PrincipalId ]`: The unique identifier (id) for the user, group or service principal being granted the app role. Required on create. + - `[ResourceDisplayName ]`: The display name of the resource app's service principal to which the assignment is made. + - `[ResourceId ]`: The unique identifier (id) for the resource service principal for which the assignment is made. Required on create. Supports $filter (eq only). + +## RELATED LINKS + diff --git a/src/Resources/MSGraph.Autorest/examples/Get-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/examples/Get-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..657f5671ea1b --- /dev/null +++ b/src/Resources/MSGraph.Autorest/examples/Get-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,27 @@ +### Example 1: List assigned app roles +```powershell +Get-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +Zbm-cUeDXUmlicIc3eenIhHyPMkzw2VEh76fTc0bGtM e799a9e2-acac-4960-9ba0-6a17661fa16a funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 6:56:52 AM +``` + +List assigned app roles. + +### Example 2: Get by AppRoleAssignmentId +```powershell +Get-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +``` + +Get an assigned app role by Id. + diff --git a/src/Resources/MSGraph.Autorest/examples/New-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/examples/New-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..5d23a1688a21 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/examples/New-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,26 @@ +### Example 1: ObjectIdWithResourceIdParameterSet +```powershell +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -ResourceId 351fa797-c81a-4998-9720-4c2ecb6c7abc -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIkgIm8kv9kJPj4MFhepACNE 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:04:28 AM +``` + +Create an appRoleAssignment using ServicePrincipalId and ResourceId. + +### Example 2: SPNWithResourceDisplayNameParameterSet +```powershell +New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalDisplayName funapp1214 -ResourceDisplayName nori-sp -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +```output +Id AppRoleId PrincipalDisplayName PrincipalId CreatedDateTime +-- --------- -------------------- ----------- --------------- +Zbm-cUeDXUmlicIc3eenIlqgWRlWp2hFrXIJiqP2j78 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 funapp1214 71beb965-8347-495d-a589-c21cdde7a722 12/14/2023 7:07:16 AM +``` + +Create an appRoleAssignment for service principal using ServicePrincipal DisplayName and Resource DisplayName. + diff --git a/src/Resources/MSGraph.Autorest/examples/Remove-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/examples/Remove-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..63456663aaee --- /dev/null +++ b/src/Resources/MSGraph.Autorest/examples/Remove-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,7 @@ +### Example 1: Remove an app role from service principal +```powershell +Remove-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIlTWN1A5UVFMigS0D3ED-dk -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 +``` + +Remove an app role from service principal. + diff --git a/src/Resources/MSGraph.Autorest/examples/Update-AzADServicePrincipalAppRoleAssignment.md b/src/Resources/MSGraph.Autorest/examples/Update-AzADServicePrincipalAppRoleAssignment.md new file mode 100644 index 000000000000..2e95a98b2f78 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/examples/Update-AzADServicePrincipalAppRoleAssignment.md @@ -0,0 +1,6 @@ +### Example 1: Update the AppRoleId +```powershell +Update-AzADServicePrincipalAppRoleAssignment -AppRoleAssignmentId Zbm-cUeDXUmlicIc3eenIoFW9pZ_gRBIudKgu0gaMIw -ServicePrincipalId 71beb965-8347-495d-a589-c21cdde7a722 -AppRoleId 649ae968-bdf9-4f22-bb2c-2aa1b4af0a83 +``` + +Update the assigned App role id. \ No newline at end of file diff --git a/src/Resources/MSGraph.Autorest/test/Get-AzADGroupOwner.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/Get-AzADGroupOwner.Tests.ps1 new file mode 100644 index 000000000000..58729d0cb9b3 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/Get-AzADGroupOwner.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzADGroupOwner')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzADGroupOwner.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzADGroupOwner' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/Get-AzADServicePrincipalAppRoleAssignment.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/Get-AzADServicePrincipalAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000000..ee253bd1f443 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/Get-AzADServicePrincipalAppRoleAssignment.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzADServicePrincipalAppRoleAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzADServicePrincipalAppRoleAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzADServicePrincipalAppRoleAssignment' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/New-AzADGroupOwner.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/New-AzADGroupOwner.Tests.ps1 new file mode 100644 index 000000000000..a032c08cb1e4 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/New-AzADGroupOwner.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzADGroupOwner')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzADGroupOwner.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzADGroupOwner' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/New-AzADServicePrincipalAppRoleAssignment.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/New-AzADServicePrincipalAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000000..9416326b85db --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/New-AzADServicePrincipalAppRoleAssignment.Tests.ps1 @@ -0,0 +1,34 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzADServicePrincipalAppRoleAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzADServicePrincipalAppRoleAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzADServicePrincipalAppRoleAssignment' { + It 'ObjectIdWithResourceIdParameterSet' -skip { + $appRa = New-AzADServicePrincipalAppRoleAssignment -ServicePrincipalId $env.spId1 -ResourceId $env.resourceId1 -AppRoleId $env.appRoleId + $appRa.AppRoleId | Should -Be $env.appRoleId + } + + It 'ObjectIdWithResourceDisplayNameParameterSet' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SPNWithResourceIdParameterSet' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SPNWithResourceDisplayNameParameterSet' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/Remove-AzADGroupOwner.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/Remove-AzADGroupOwner.Tests.ps1 new file mode 100644 index 000000000000..5e0324a5f1ed --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/Remove-AzADGroupOwner.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzADGroupOwner')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzADGroupOwner.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzADGroupOwner' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/Remove-AzADServicePrincipalAppRoleAssignment.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/Remove-AzADServicePrincipalAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000000..d52ad6731787 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/Remove-AzADServicePrincipalAppRoleAssignment.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzADServicePrincipalAppRoleAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzADServicePrincipalAppRoleAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzADServicePrincipalAppRoleAssignment' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/Update-AzADServicePrincipalAppRoleAssignment.Tests.ps1 b/src/Resources/MSGraph.Autorest/test/Update-AzADServicePrincipalAppRoleAssignment.Tests.ps1 new file mode 100644 index 000000000000..da6e41f7dc0a --- /dev/null +++ b/src/Resources/MSGraph.Autorest/test/Update-AzADServicePrincipalAppRoleAssignment.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzADServicePrincipalAppRoleAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzADServicePrincipalAppRoleAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzADServicePrincipalAppRoleAssignment' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Update' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Resources/MSGraph.Autorest/test/localEnv.json b/src/Resources/MSGraph.Autorest/test/localEnv.json index b7e55ac9ef30..5ec84a0e3729 100644 --- a/src/Resources/MSGraph.Autorest/test/localEnv.json +++ b/src/Resources/MSGraph.Autorest/test/localEnv.json @@ -9,5 +9,8 @@ "spName1": "2022-02-22-testsphql7405x", "homepage1": "https://2022-02-22-home1.com", "appName1": "2022-02-22-testappec56qaw2", - "appName2": "2022-02-22-testappdhlw3jr1" + "appName2": "2022-02-22-testappdhlw3jr1", + "appRoleId": "e799a9e2-acac-4960-9ba0-6a17661fa16a", + "spId1": "71beb965-8347-495d-a589-c21cdde7a722", + "resourceId1": "351fa797-c81a-4998-9720-4c2ecb6c7abc" } diff --git a/src/Resources/OpenApiSpecs/v1.0/Applications.yml b/src/Resources/OpenApiSpecs/v1.0/Applications.yml index 7c55243bc5cd..5e7b24a02f6f 100644 --- a/src/Resources/OpenApiSpecs/v1.0/Applications.yml +++ b/src/Resources/OpenApiSpecs/v1.0/Applications.yml @@ -1242,6 +1242,252 @@ paths: default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + '/servicePrincipals/{servicePrincipal-id}/appRoleAssignments': + get: + tags: + - servicePrincipals.appRoleAssignment + summary: Get appRoleAssignments from servicePrincipals + operationId: servicePrincipals_ListAppRoleAssignments + parameters: + - name: servicePrincipal-id + in: path + description: 'key: id of servicePrincipal' + required: true + schema: + type: string + x-ms-docs-key-type: servicePrincipal + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/search' + - $ref: '#/components/parameters/filter' + - $ref: '#/components/parameters/count' + - name: $orderby + in: query + description: Order items by property values + style: form + explode: false + schema: + uniqueItems: true + type: array + items: + enum: + - id + - id desc + - deletedDateTime + - deletedDateTime desc + - appRoleId + - appRoleId desc + - createdDateTime + - createdDateTime desc + - principalDisplayName + - principalDisplayName desc + - principalId + - principalId desc + - principalType + - principalType desc + - resourceDisplayName + - resourceDisplayName desc + - resourceId + - resourceId desc + type: string + - name: $select + in: query + description: Select properties to be returned + style: form + explode: false + schema: + uniqueItems: true + type: array + items: + enum: + - id + - deletedDateTime + - appRoleId + - createdDateTime + - principalDisplayName + - principalId + - principalType + - resourceDisplayName + - resourceId + type: string + - name: $expand + in: query + description: Expand related entities + style: form + explode: false + schema: + uniqueItems: true + type: array + items: + enum: + - '*' + type: string + responses: + '200': + $ref: '#/components/responses/microsoft.graph.appRoleAssignmentCollectionResponse' + default: + $ref: '#/components/responses/error' + x-ms-pageable: + nextLinkName: '@odata.nextLink' + operationName: listMore + x-ms-docs-operation-type: operation + post: + tags: + - servicePrincipals.appRoleAssignment + summary: Create new navigation property to appRoleAssignments for servicePrincipals + operationId: servicePrincipals_CreateAppRoleAssignments + parameters: + - name: servicePrincipal-id + in: path + description: 'key: id of servicePrincipal' + required: true + schema: + type: string + x-ms-docs-key-type: servicePrincipal + requestBody: + description: New navigation property + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignment' + required: true + responses: + '201': + description: Created navigation property. + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignment' + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation + '/servicePrincipals/{servicePrincipal-id}/appRoleAssignments/{appRoleAssignment-id}': + get: + tags: + - servicePrincipals.appRoleAssignment + summary: Get appRoleAssignments from servicePrincipals + operationId: servicePrincipals_GetAppRoleAssignments + parameters: + - name: servicePrincipal-id + in: path + description: 'key: id of servicePrincipal' + required: true + schema: + type: string + x-ms-docs-key-type: servicePrincipal + - name: appRoleAssignment-id + in: path + description: 'key: id of appRoleAssignment' + required: true + schema: + type: string + x-ms-docs-key-type: appRoleAssignment + - name: $select + in: query + description: Select properties to be returned + style: form + explode: false + schema: + uniqueItems: true + type: array + items: + enum: + - id + - deletedDateTime + - appRoleId + - createdDateTime + - principalDisplayName + - principalId + - principalType + - resourceDisplayName + - resourceId + type: string + - name: $expand + in: query + description: Expand related entities + style: form + explode: false + schema: + uniqueItems: true + type: array + items: + enum: + - '*' + type: string + responses: + '200': + description: Retrieved navigation property + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignment' + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation + patch: + tags: + - servicePrincipals.appRoleAssignment + summary: Update the navigation property appRoleAssignments in servicePrincipals + operationId: servicePrincipals_UpdateAppRoleAssignments + parameters: + - name: servicePrincipal-id + in: path + description: 'key: id of servicePrincipal' + required: true + schema: + type: string + x-ms-docs-key-type: servicePrincipal + - name: appRoleAssignment-id + in: path + description: 'key: id of appRoleAssignment' + required: true + schema: + type: string + x-ms-docs-key-type: appRoleAssignment + requestBody: + description: New navigation property values + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignment' + required: true + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation + delete: + tags: + - servicePrincipals.appRoleAssignment + summary: Delete navigation property appRoleAssignments for servicePrincipals + operationId: servicePrincipals_DeleteAppRoleAssignments + parameters: + - name: servicePrincipal-id + in: path + description: 'key: id of servicePrincipal' + required: true + schema: + type: string + x-ms-docs-key-type: servicePrincipal + - name: appRoleAssignment-id + in: path + description: 'key: id of appRoleAssignment' + required: true + schema: + type: string + x-ms-docs-key-type: appRoleAssignment + - name: If-Match + in: header + description: ETag + schema: + type: string + responses: + '204': + description: Success + default: + $ref: '#/components/responses/error' + x-ms-docs-operation-type: operation '/servicePrincipals/{servicePrincipal-id}/federatedIdentityCredentials': get: tags: @@ -2460,6 +2706,18 @@ components: nullable: true additionalProperties: type: object + microsoft.graph.appRoleAssignmentCollectionResponse: + title: Collection of appRoleAssignment + type: object + properties: + value: + type: array + items: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignment' + '@odata.nextLink': + type: string + additionalProperties: + type: object microsoft.graph.informationalUrl: title: informationalUrl type: object @@ -2830,6 +3088,12 @@ components: application/json: schema: $ref: '#/components/schemas/microsoft.graph.federatedIdentityCredentialCollectionResponse' + microsoft.graph.appRoleAssignmentCollectionResponse: + description: Retrieved collection + content: + application/json: + schema: + $ref: '#/components/schemas/microsoft.graph.appRoleAssignmentCollectionResponse' parameters: top: name: $top