New command: π spo web roleinheritance break
Usage
m365 spo web roleinheritance break [options]
Description
break inheritance of subsite. Keeping existing permissions is the default behavior.
Options
| Option | Description |
|---|---|
-u, --webUrl <webUrl> |
URL of the site |
-c --clearExistingPermissions |
Flag if used clears all roles from the web |
--confirm |
Don't prompt for confirmation |
Examples
break role inheritance on web with keeping existing permissions
m365 spo web roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/contoso-sales"
break role inheritance on web with clearing existing permissions
m365 spo web roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --clearExistingPermissions
Additional Info
I did some research and for this command we may use the POST request
/_api/web/breakroleinheritance(${TrueOrFalseHere})
i want to use this command, how to? the @next version seems don't have it
@quantrpeter thanks for reaching out π This is still an opened issue so it means it was not developed yet and we plan to do so in near future by either one of the maintainers or our awesome contributors π€©. Currently CLI supports breaking role inheritance on list/lib π https://pnp.github.io/cli-microsoft365/cmd/spo/list/list-roleinheritance-break/ and listitem/file/folder/page level πhttps://pnp.github.io/cli-microsoft365/cmd/spo/listitem/listitem-roleinheritance-break/
please feel free to join the discussion abut this command if you see something lacking. When this issue spec is formally expected by some other @pnp/cli-for-microsoft-365-maintainers then this issue will be also opened to be developed π
Shall I pickup the dev? My customer need this command. If yes please tell me how to start? any dev guide?
Shall I pickup the dev? My customer need this command. If yes please tell me how to start? any dev guide?
@quantrpeter this one is not yet ready to start development. Let's give it 1-2 days more for any other maintainer to give it a check and lets see if we should correct/add something to the spec or we can start working on this one. It will be labeled with 'help wanted' label when this one is ready to be developed. π
π Here is some general guidance on how to contribute to our repo and add a new command https://github.com/pnp/cli-microsoft365/blob/main/CONTRIBUTING.md https://github.com/pnp/cli-microsoft365/wiki/Adding-a-command
π©βπ» as for the main code for this command I believe it will be like 95% similar to already developed one on the list level (https://github.com/pnp/cli-microsoft365/blob/main/src/m365/spo/commands/list/list-roleinheritance-break.ts) the only difference is that will have less options and web api endpoint won't target list by id or title but just the web itself π€. At least this is what I was aiming π
Spec seems solid. Let's do it! π
@quantrpeter this one is ready to be developed. Are you still interested in coding this one? Should I assign it to you? Let me know if you will need any help to start π
yes, please, very interest
yes, please, very interest
done β. let me know if you will need any help to start π
sorry is these steps correct?
- i fork this repo
- create a file call "web-break-inhreitance.ts" in src/m365/spo/commands/web
- fire a pull request
- done
@quantrpeter almost good π.
- yes β
- not enough. the command file name should be web-roleinheritance-break.ts. And also this is not the only file/change required. Please double check the Adding new command wiki page. Also a couple of days ego I created a very similar PR for the reset command so you may also double check with this one what is required web-roleinheritance-reset PR. We need changes in 5 files. Doc.md file + add it to the list, add a new command to the list, add the command action and the test with 100% test coverage for it π.
- yes β . after your done and you tested it on your end and runed the tests you should open a PR πplease check the Submitting-a-PR wiki page. If your are interested how the review process will be taken care of please check What-to-expect-during-a-Pull-request-review
- if the PR is ok and you have no review comments to resolve then yes. It is done and the merging is on us π
let me know if you need any additional info/help π
will send pull request this week, thx
will send pull request this week, thx
great news π€©. no rush π. Let me know if you will need any help π
Updated the specs to add an extra option --confirm.
Discussed here: https://github.com/pnp/cli-microsoft365/issues/3593#issuecomment-1234828680
We have updated the code, what we should do? fire a new pull request? thanks
We have updated the code, what we should do? fire a new pull request? thanks
Hey @quantrpeter
Creating a new PR is not needed. All you have to do is push your new code to the same branch you worked on previously. Your old PR will be updated automatically.
If I'm not mistaken, last time you worked on your main branch.
Tip for next time: create a new branch based on your main branch to work on one issue.
sorry for the dumb question, If I switch to a new branch. Will the PR follow? If no, I need to submit a new PR. Thank you very much
As you can see here, your current PR is linked with your main branch.

This means that every change you push to your main branch will be visible in the PR. If you work on another branch, these changes will not show up in this PR. So if you made your changes on a different branch, you should create a new PR.
This is the reason why I said that you should make a new branch next time for each issue you are working on. By doing this, you can switch branches quite easy without impacting your other PRs.
If you have any questions, feel free to ask. In the beginning it is always a bit harder that's normal. π
thanks @milanholemans
yeah, we finally make it, thanks @milanholemans