PSMSGraph icon indicating copy to clipboard operation
PSMSGraph copied to clipboard

100% Code Coverage for Add-AADAppRoleAssignment

Open markekraus opened this issue 7 years ago • 0 comments

Code coverage report: Covered 0 % of 33 analyzed Commands in Add-AADAppRoleAssignment Missed commands:

Line Command
78 $ServicePrincipal
79 $User
80 $ProcessText = "User: '{0}' ServicePrincipal: '{1}' RoleID: '{2}'" -f $UserObject.ObjectId, $ServiceObject.ObjectId, $RoleID
81 if (-not $pscmdlet.ShouldProcess($ProcessText)) { ...
84 $AccessToken = $ServiceObject._AccessToken
85 $Application = $AccessToken.Application
86 $Tenant = $Application.Tenant
87 $Body = @{ ...
88 id = $RoleID
89 resourceId = $ServiceObject.ObjectId
90 principalId = $UserObject.ObjectId
91 $Body = @{ ...
92 $Url = '{0}/{1}/{2}/{3}/{4}?api-version={5}' -f @( ...
93 $BaseUrl
94 $Tenant
95 'users'
96 $UserObject.ObjectId
97 'appRoleAssignments'
98 $APIversion
100 $Params = @{ ...
101 Uri = $Url
102 Body = $Body
103 Method = 'POST'
104 AccessToken = $AccessToken
105 ErrorAction = 'Stop'
108 $Result = Invoke-GraphRequest @Params
111 ``` $ErrorMessage = "Unable to add App Assignments for User '{0}' to ServicePrincipal '{1}': {2}" -f $UserObject.ObjectId, $ServiceObject.Objec
tId, $_.Exception.Message ```
112 Write-Error $ErrorMessage
115 $OutputObject = $Result.ContentObject.psobject.copy()
116 $OutputObject.psobject.TypeNames.Insert(0, 'MSGraphAPI.DirectoryObject.AppRoleAssignment')
117 $OutputObject
117 Add-Member -MemberType NoteProperty -Name _AccessToken -Value $AccessToken
118 $OutputObject

markekraus avatar Apr 22 '17 16:04 markekraus