Skip to content

Adding new Powershell cmdlets to support set/get/remove of Azure AD administrator on MI #10057

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

Merged
merged 21 commits into from
Oct 4, 2019
Merged

Adding new Powershell cmdlets to support set/get/remove of Azure AD administrator on MI #10057

merged 21 commits into from
Oct 4, 2019

Conversation

SanjaMalesevic
Copy link
Contributor

@SanjaMalesevic SanjaMalesevic commented Sep 18, 2019

Description

Design review: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/363

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

@adxsdkps
Copy link
Collaborator

Can one of the admins verify this patch?

The other tests which use Graph API are disabled because of existing problem with Graph authentication. 
I succeed to execute this test locally, but in error logs I saw this error:
Unable to find a matching HTTP request for URL 'POST /72f988bf-86f1-41af-91ab-2d7cd011db47/getObjectsByObjectIds?'
Here is the request from recorded json file 'POST /0c1edf5d-e5c5-4aca-ab69-ef194134f44b/getObjectsByObjectIds?api-version=1.6'.
As you could see, the tenantId is different.
Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

@SanjaMalesevic Please see my inline comments, thanks.

@isra-fel
Copy link
Member

TODO for me: resolve markdown conflict once #10074 is merged

@isra-fel isra-fel assigned isra-fel and unassigned SanjaMalesevic Sep 26, 2019
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.

A couple of test chnages, otherwise LGTM

{
# Setup
$rg = Create-ResourceGroupForTest
$vnetName = "cl_initial"
Copy link
Member

Choose a reason for hiding this comment

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

You should generate random names for these - this allows each test execution to be indpenendent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I check all other tests in SQL module, and they don't use random name for vnet. I suppose that the vnet's should stay deterministic so in the record mode the next test can create MI quickly. Also, I noticed that the vnet is never dropped.
So, if you agreee I would leave this as it is now.

Copy link
Member

Choose a reason for hiding this comment

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

There is an entire facility for creatingand recording random names used by essentially every other test project. As you have this now, anyone who runs two of your tests in the same subscription will fail. Please fix this.

function Test-ManagedInstanceActiveDirectoryAdministrator
{
# Setup
$rg = Create-ResourceGroupForTest
Copy link
Member

Choose a reason for hiding this comment

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

You should follow the pattern of cleaning up created resources as part of the test, using a try/finally after creating the resource group, where the ResourceGroup is removed in the finally is generally the pattern to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if (HttpMockServer.Mode == HttpRecorderMode.Record)
{
tenantId = TestEnvironmentFactory.GetTestEnvironment().Tenant;
}
Copy link
Member

Choose a reason for hiding this comment

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

You want to store the tenant ID in HttpMockServer.Variables in this case, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@markcowl markcowl dismissed isra-fel’s stale review October 4, 2019 12:33

All comments addressed

@markcowl markcowl merged commit 6eed678 into Azure:master Oct 4, 2019
isra-fel added a commit that referenced this pull request Oct 8, 2019
After #10074 was merged, #10057 should have updated `ChangeLog.md` but it didn't, so I'm doing it right now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants