Automating SonarCloud with PowerShell – Part 3 Onboarding a User
Warning: this post contains unsupported API calls, so use at your own risk
Similar to the situation in Part 2 for onboarding a project into SonarCloud, onboarding a user into an organization is also not supported via the public API.
In the API documentation there is no entry for api/organizations
This was confirmed by a community posting and unfortunately did not appear on the roadmap:
Back to Chrome Developer Tools
So in the same way as in Part 2 I used Chrome Developer Tools to monitor what happens in the SonarCloud UI when adding a member to an organization:
We can see that a URL of /api/organizations/add_member
is used:
The payload contained two items:
- login – the GitLab user id
- organization – the SonarCloud organization
Consequently the Add-SonarCloudOrganizationMember function was born and we can now fully onboard a user to an organization with the following:
The user is successfully onboarded to the organisation:
- Automating SonarCloud with PowerShell – Part 1 Introduction
- Automating SonarCloud with PowerShell – Part 2 Onboarding a Project
- Automating SonarCloud with PowerShell – Part 3 Onboarding a User