Skip to content

Conversation

@cormacpayne
Copy link
Member

@cormacpayne cormacpayne commented May 22, 2018

Description

  • Revert the change to New-AzureRmADServicePrincipal that gave "Contributor" permissions to the current subscription by default if Role and Scope parameters weren't provided. The behavior now goes back to before the 6.0.0 release where no permissions are assigned to the service principal if Role and Scope aren't provided, but use the values provided (or default values) if one (or both) of the parameters are provided.
  • Update the examples for New-AzureRmADServicePrincipal to reflect these changes, as well as update the descriptions for the cmdlet and the affected parameters

Checklist

@cormacpayne cormacpayne changed the title Update documentation and messages displayed for New-AzureRmADServicePrincipal Revert default role assignment for New-AzureRmADServicePrincipal May 23, 2018
@cormacpayne
Copy link
Member Author

* Revert change to `New-AzureRmADServicePrincipal` that gave service principals "Contributor" permissions over the current subscription if no values were provided for the `Role` or `Scope` parameters
- If no values are provided for `Role` or `Scope`, the service principal is created with no permissions
- If a `Role` is provided, but no `Scope`, the service principal is created with the specified `Role` permissions over the current subscription
- If a `Scope` is provided, but no `Contributor`, the service principal is created with `Contributor` permissions over the specified `Scope`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contributor [](start = 40, length = 11)

role

@darshanhs90
Copy link
Contributor

            Role = "Contributor";

why are we defaulting to contributor role,when a role isnt provided?


Refers to: src/ResourceManager/Resources/Commands.Resources/ActiveDirectory/NewAzureADServicePrincipalCommand.cs:281 in 0acb1cf. [](commit_id = 0acb1cf, deletion_comment = False)

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How easy would it be to add a test covering each of the two parameter sets? If possible we should add before checking in. Otherwise, we should verify each scenario manually and file an issue to record the new tests this sprint.

@markcowl
Copy link
Member

@darshanhs90 Because that is our best guess at what the user would want in this case - since no previous versions of the cmdlet have role or scope as a parameter, there is no chance of an existing script hitting unexpected behavior in this case, as they have to provide at least 'Scope'

twitchax
twitchax previously approved these changes May 23, 2018
Copy link
Contributor

@twitchax twitchax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great work, @cormacpayne.

@twitchax
Copy link
Contributor

@darshanhs90, the new behavior is meant to match the Azure CLI behavior, so the default Role is Contributor, as it is in CLI.

@cormacpayne
Copy link
Member Author

@cormacpayne
Copy link
Member Author

@darshanhs90 @markcowl comments addressed and tests added

@cormacpayne
Copy link
Member Author

cormacpayne commented May 24, 2018

ChangeLog.md Outdated
* Revert change to `New-AzureRmADServicePrincipal` that gave service principals `Contributor` permissions over the current subscription if no values were provided for the `Role` or `Scope` parameters
- If no values are provided for `Role` or `Scope`, the service principal is created with no permissions
- If a `Role` is provided, but no `Scope`, the service principal is created with the specified `Role` permissions over the current subscription
- If a `Scope` is provided, but no `Scope`, the service principal is created with `Contributor` permissions over the specified `Scope`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Role?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darshanhs90 oops, thanks. Fixed this in all occurrences.

* Revert change to `New-AzureRmADServicePrincipal` that gave service principals `Contributor` permissions over the current subscription if no values were provided for the `Role` or `Scope` parameters
- If no values are provided for `Role` or `Scope`, the service principal is created with no permissions
- If a `Role` is provided, but no `Scope`, the service principal is created with the specified `Role` permissions over the current subscription
- If a `Scope` is provided, but no `Scope`, the service principal is created with `Contributor` permissions over the specified `Scope`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Role

* Revert change to `New-AzureRmADServicePrincipal` that gave service principals `Contributor` permissions over the current subscription if no values were provided for the `Role` or `Scope` parameters
- If no values are provided for `Role` or `Scope`, the service principal is created with no permissions
- If a `Role` is provided, but no `Scope`, the service principal is created with the specified `Role` permissions over the current subscription
- If a `Scope` is provided, but no `Scope`, the service principal is created with `Contributor` permissions over the specified `Scope`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Role

#>
function Test-NewADServicePrincipalWithReaderRole
{
# Setup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add another test where in we dont specify any role or scope and make sure that no roleassignment change happens before and after running the command

Copy link
Member Author

@cormacpayne cormacpayne May 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darshanhs90 added a check in Test-NewADServicePrincipalWithoutApp that no role assignment was created for the new service principal

@cormacpayne
Copy link
Member Author

@cormacpayne cormacpayne changed the base branch from preview to release-6.1.1 May 25, 2018 22:41
@cormacpayne cormacpayne changed the base branch from release-6.1.1 to preview May 25, 2018 22:42
@cormacpayne cormacpayne changed the base branch from preview to release-6.1.1 May 25, 2018 22:43
@cormacpayne cormacpayne merged commit 33da488 into Azure:release-6.1.1 May 29, 2018
@cormacpayne cormacpayne deleted the update-new-sp branch January 16, 2019 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants