-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a JSON file to store permission scopes required for ScubaGear #1380
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can you move the file from the /Connection folder to a new /Permissions folder instead?
- I noticed you removed the ScubaGearSPPermissions node. In the future ScubaGear will have a utility script that helps users register a service principal to run the tool. Is the thought that our new utility script can just filter the GraphCmdLetPermissions node for entries that are of runtype = application and just use that list to create the needed permissions for the service principal in Entra Id?
- We need to add the following REST APIs as entries to the GraphCmdLetPermissions node along with their associated required permissions. Entra Id now includes direct calls to REST APIs without Cmdlets and therefore we need to ensure those permissions are represented.
- /beta/roleManagement/directory/roleEligibilityScheduleInstances
- /beta/roleManagement/directory/roleAssignmentScheduleInstances
- /beta/identityGovernance/privilegedAccess/group/eligibilityScheduleInstances
- /beta/privilegedAccess/aadGroups/resources
79d40ae
to
1218df3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor recommendation for the format as we've had code trip over string vs list values before when it isn't consistent.
PowerShell/ScubaGear/Modules/Permissions/ScubaGear-Permissions.json
Outdated
Show resolved
Hide resolved
1218df3
to
3dc451f
Compare
40c59a0
to
23a7323
Compare
23a7323
to
9d48ea1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few more multi-valued fields that are represented as strings when singletons. Recommend consistently representing as multi-valued structure (array or dictionary) to make the structure easier to traverse in all cases. Specific fields and examples are included in review comments below.
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
Updated leastPermissions and poshModule keys to array type. |
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
"commercial", | ||
"gcc", | ||
"gcchigh", | ||
"dod" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to all of the JSON objects in this file. Do we know for sure that this works for dod
?
We have this DoD diclaimer as we've never tested on a DoD
tenant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think since we include DoD endpoints as a valid option for the M365Environment
parameter across many commandlets, we keep references to dod
for consistency purposes until a public-reported issue is received saying otherwise.
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
"dod": "https://{domain}-admin.sharepoint.mil.us" | ||
}, | ||
"poshModule": ["Microsoft.Online.SharePoint.PowerShell"], | ||
"leastPermissions": ["Sites.FullControl.All"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connect-SPOService
doesn't support Service Principal auth. This should be empty array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new property was added to indicate noninteractive permissions, "spRolePermissions": []
. @buidav does that resolve your comment? Or are additional changes needed.
PowerShell/ScubaGear/Modules/Permissions/ScubaGearPermissions.json
Outdated
Show resolved
Hide resolved
Updated permissions file to reflect discussion last week. Unified keys across objects, renamed rolePermissions to spRolePermissions. Created singular objects for connect cmdlets to break out apiResource based on the environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates addressed previous comments. Looks merge ready to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items 1 - 4 were observed when attempting to use this JSON as the source of permissions for ScubaGear.
- "RoleManagementPolicy.Read.Directory" was listed as a least permission. However ScubaGear does not use this permission.
Does ScubaGear use something else not listed?
"moduleCmdlet": "Get-MgBetaPolicyRoleManagementPolicyAssignment",
"CareSource": "/beta/policies/roleManagementPolicyAssignments",
"poshModule": [
"Microsoft.Graph.Beta.Identity.SignIns"
],
"leastPermissions": [
"RoleManagementPolicy.Read.Directory"
],
"higherPermissions": [
"RoleManagement.ReadWrite.Directory",
"RoleManagement.Read.All",
"RoleManagementPolicy.ReadWrite.Directory"
],
This JSON lists
RoleManagementPolicy.Read.Directory as least permissions for this cmdlet.
ScubaGear does not use any permissions in least Permissions or higher permissions listed here.
AI says Policy.Read,All is needed. ScubaGear does use Policy.Read.All but it's not enough for this cmdlet -1 for AI.
Graph explorer says RoleManagementPolicy.Read.Directory
Double checking with Ted
ScubaGear uses RoleManagment.Read.Directory
which is NOT listed anywhere in the JSON. Either we have to modify ScubaGear's permissions or add RoleManagment.Read.Directory
under the higherPermissions
listed here.
- "RoleManagement.Read.All" was listed as a least permission. However ScubaGear does not use this permission.
Does ScubaGear use something else not listed?
Get-MgBetaRoleManagementDirectoryRoleAssignmentScheduleInstance
"apiResource": "/beta/roleManagement/directory/roleAssignmentScheduleInstances",
"poshModule": [
"Microsoft.Graph.Beta.Identity.Governance"
],
"leastPermissions": [
"RoleAssignmentSchedule.Read.Directory"
],
"higherPermissions": [
"RoleAssignmentSchedule.ReadWrite.Directory",
"RoleManagement.ReadWrite.Directory",
"RoleManagement.Read.All",
"RoleManagement.Read.Directory"
],
The JSON uses
"RoleAssignmentSchedule.Read.Directory"
With help from Ted. ScubaGear uses
"RoleManagement.Read.Directory"
We use the higher level permission which serves as the leastPermission
in a different cmdlet.
- "RoleEligibilitySchedule.Read.Directory" was listed as a least permission. However ScubaGear does not use this permission.
Does ScubaGear use something else not listed?
Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleInstance
"moduleCmdlet": "Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleInstance",
"apiResource": "/beta/roleManagement/directory/roleEligibilityScheduleInstances",
"poshModule": [
"Microsoft.Graph.Beta.Identity.Governance"
],
"leastPermissions": [
"RoleEligibilitySchedule.Read.Directory"
],
"higherPermissions": [
"RoleEligibilitySchedule.ReadWrite.Directory",
"RoleManagement.Read.All",
"RoleManagement.Read.Directory",
"RoleManagement.ReadWrite.Directory"
],
With help from Ted.
ScubaGear uses RoleManagement.Read.Directory
We're using a higher level permission as it serves as a leastPermission
in a another cmdlet.
- "RoleManagementPolicy.Read.AzureADGroup" is NO where to be found in the JSON. Despite ScubaGear using the permission.
Not at all in the JSON and it's used as a permission within ScubaGear. Not sure which cmdlet throws the error but looks like something in our custom AAD provider functions. (I wish I took a screenshot someone will have to recreate the error)
This permission needs to be added to the JSON somewhere.
How does the helper function(s) account for these differences in permission sets between ScubaGear and the JSON?
Do we need to change ScubaGear's permissions or modify the JSON itself?
Those questions need can be answer later.
However, points 1 and 4 need to be addressed in this PR somehow.
🗣 Description
Permissions file containing current SCuBAGear permissions mapping.
💭 Motivation and context
Added permissions file to allow centralized management of all SCuBAGear Microsoft Graph permissions.
#1391 is a follow up to this issue, which aims to modify the Connection module to read from the new ScubaPermissions.json file instead of hard coded values.
Closes #1356
🧪 Testing
Testing was conducted across commercial and gcchigh tenants. Created PowerShell code that imported the JSON file and made connections to Microsoft Graph utilizing the permission scopes defined under Permission within the ScubaGearGraphScopes section of the file.
✅ Pre-approval checklist
✅ Pre-merge checklist
PR passed smoke test check.
Feature branch has been rebased against changes from parent branch, as needed
Use
Rebase branch
button below or use this reference to rebase from the command line.Resolved all merge conflicts on branch
Notified merge coordinator that PR is ready for merge via comment mention
✅ Post-merge checklist