-
Notifications
You must be signed in to change notification settings - Fork 27
Enganga/bulk url update #1439
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
base: main
Are you sure you want to change the base?
Enganga/bulk url update #1439
Conversation
Learn Build status updates of commit a8c91af: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 4f5bec0: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 5e69f15: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
5e69f15
to
0ece451
Compare
Learn Build status updates of commit 0ece451: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
0ece451
to
bfa26d5
Compare
Learn Build status updates of commit bfa26d5: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 7034cc2: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 66f535f: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 32bcb8e: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
module/Entra/Microsoft.Entra/Applications/Add-EntraServicePrincipalOwner.ps1
Outdated
Show resolved
Hide resolved
module/Entra/Microsoft.Entra/Applications/Get-EntraApplicationTemplate.ps1
Show resolved
Hide resolved
module/Entra/Microsoft.Entra/DirectoryManagement/Get-EntraPartnerInformation.ps1
Outdated
Show resolved
Hide resolved
Learn Build status updates of commit eb932c2: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit aefad9a: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit dc805e5: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 9283270: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit b30bc9d: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 354e134: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit e746fdb: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
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.
Looks good! Requested changes are only "nit-picks" and requests for clarification.
- Pascal case, per project guidelines
- Consistent spacing
- Question about use of
$BaseUri
vs$RootUri
And a thought for future iterations: is there any potential benefit to creating a reusable function for defining the BaseUri dynamically based on what Graph resource type is being queried / CRUD?
$environment = (Get-EntraContext).Environment | ||
$rootUri = (Get-EntraEnvironment -Name $environment).GraphEndpoint |
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.
How do you feel about replacing these two lines with one to reduce the number of variables being created? The alternate cost is that it's not quite as easy to read at first glance.
$RootUri = (Get-MgEnvironment -Name (Get-MgContext).Environment).GraphEndpoint
$environment = (Get-EntraContext).Environment | ||
$rootUri = (Get-EntraEnvironment -Name $environment).GraphEndpoint |
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 encourage the same design guidelines that are documented in this project, including the use of Pascal case for names of functions, parameters, etc. It might be a nit-pick, but consistency is very helpful in a project. :)
@@ -16,7 +16,7 @@ function Get-EntraScopedRoleMembership { | |||
$params = @{} | |||
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand | |||
$isList = $false | |||
$baseUri = "https://graph.microsoft.com/v1.0/directory/administrativeUnits" | |||
$baseUri = "/v1.0/directory/administrativeUnits" |
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.
Nit-pick / observation: many of these could be in single quotes when variables do not need to be expanded within the string. Change not required, but it can be a helpful practice to adopt.
@@ -59,7 +61,7 @@ function Add-EntraGroupOwner { | |||
} | |||
if ($null -ne $PSBoundParameters["OwnerId"]) { | |||
$TmpValue = $PSBoundParameters["OwnerId"] | |||
$Value = @{ "@odata.id" = "https://graph.microsoft.com/beta/users/$TmpValue" } | |||
$Value = @{ "@odata.id" = "$rootUri/beta/users/$TmpValue" } |
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 just now noticed that some of these changes use $RootUri
and some use $BaseUri
. Is this an intentional distinction for when utilizing different MgGraph cmdlets?
module/EntraBeta/Microsoft.Entra.Beta/Groups/Add-EntraBetaGroupOwner.ps1
Outdated
Show resolved
Hide resolved
module/EntraBeta/Microsoft.Entra.Beta/NetworkAccess/New-EntraBetaPrivateAccessApplication.ps1
Show resolved
Hide resolved
module/EntraBeta/Microsoft.Entra.Beta/SignIns/Add-EntraBetaServicePrincipalPolicy.ps1
Show resolved
Hide resolved
module/EntraBeta/Microsoft.Entra.Beta/Users/Set-EntraBetaUserManager.ps1
Outdated
Show resolved
Hide resolved
module/EntraBeta/Microsoft.Entra.Beta/Users/Set-EntraBetaUserSponsor.ps1
Outdated
Show resolved
Hide resolved
Learn Build status updates of commit 3d6d252: ❌ Validation status: errorsPlease follow instructions here which may help to resolve issue.
For more details, please refer to the build report. Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them. For any questions, please:
|
Learn Build status updates of commit 4e9bdf0: ❌ Validation status: errorsPlease follow instructions here which may help to resolve issue.
For more details, please refer to the build report. Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them. For any questions, please:
|
Learn Build status updates of commit 68569f6: ❌ Validation status: errorsPlease follow instructions here which may help to resolve issue.
For more details, please refer to the build report. Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them. For any questions, please:
|
Learn Build status updates of commit 701650a: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
@@ -66,7 +66,8 @@ function Set-EntraBetaPartnerInformation { | |||
$params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug | |||
Write-Debug("=========================================================================`n") | |||
if ([string]::IsNullOrWhiteSpace($TenantId)) { | |||
$TenantID = ((Invoke-MgGraphRequest -Method GET -Uri "/beta/organization").value).id | |||
|
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.
Looks fine, just noting the extra line that got added here. :)
Write-Debug("============================ TRANSFORMATIONS ============================") | ||
$params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug | ||
Write-Debug("=========================================================================`n") | ||
if ([string]::IsNullOrWhiteSpace($TenantId)) { |
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.
Would it be simpler to mark the TenantId parameter as Mandatory and add the [ValidateNotNullOrEmpty()]
check in the parameter definition? You could also use a ValidateScript to check for whitespace and throw an error.
@@ -22,8 +22,10 @@ function Add-EntraApplicationOwner { | |||
|
|||
$newOwner = @{} | |||
|
|||
$rootUri = (Get-EntraEnvironment -Name (Get-EntraContext).Environment).GraphEndpoint | |||
|
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 add a default Graph EndPoint similar to this
if (-not $graphEndpoint) { |
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.
Fix that in all cmdlets with odataid
@@ -13,7 +13,7 @@ function Remove-EntraBetaDeletedDirectoryObject { | |||
Write-Debug("============================ TRANSFORMATIONS ============================") | |||
$params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug | |||
Write-Debug("=========================================================================`n") | |||
$URI = "https://graph.microsoft.com/v1.0/directory/deletedItems/$Id" | |||
$URI = "/v1.0/directory/deletedItems/$Id" |
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.
$URI = "/v1.0/directory/deletedItems/$Id" | |
$URI = "/beta/directory/deletedItems/$Id" |
@@ -35,7 +35,7 @@ function Add-EntraBetaDirectoryRoleMember { | |||
} | |||
if ($null -ne $PSBoundParameters["MemberId"]) { | |||
$TmpValue = $PSBoundParameters["MemberId"] | |||
$Value = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue" | |||
$Value = "/v1.0/directoryObjects/$TmpValue" |
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.
$Value = "/v1.0/directoryObjects/$TmpValue" | |
$Value = "/beta/directoryObjects/$TmpValue" |
@@ -33,7 +33,7 @@ function Add-EntraBetaFeatureRolloutPolicyDirectoryObject { | |||
} | |||
if ($null -ne $PSBoundParameters["RefObjectId"]) { | |||
$TmpValue = $PSBoundParameters["RefObjectId"] | |||
$Value = "https://graph.microsoft.com/v1.0/directoryObjects/$TmpValue" | |||
$Value = "/v1.0/directoryObjects/$TmpValue" |
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.
$Value = "/v1.0/directoryObjects/$TmpValue" | |
$Value = "/beta/directoryObjects/$TmpValue" |
@@ -226,7 +226,7 @@ function New-EntraBetaUser { | |||
$params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug | |||
Write-Debug("=========================================================================`n") | |||
$params = $params | ConvertTo-Json | |||
$response = Invoke-GraphRequest -Headers $customHeaders -Uri 'https://graph.microsoft.com/v1.0/users?$select=*' -Method POST -Body $params | |||
$response = Invoke-GraphRequest -Headers $customHeaders -Uri '/v1.0/users?$select=*' -Method POST -Body $params |
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.
$response = Invoke-GraphRequest -Headers $customHeaders -Uri '/v1.0/users?$select=*' -Method POST -Body $params | |
$response = Invoke-GraphRequest -Headers $customHeaders -Uri '/beta/users?$select=*' -Method POST -Body $params |
@@ -35,7 +37,7 @@ function Set-EntraBetaUserManager { | |||
} | |||
if ($null -ne $PSBoundParameters["ManagerId"]) { | |||
$TmpValue = $PSBoundParameters["ManagerId"] | |||
$Value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/users/$TmpValue" } | |||
$Value = @{ "@odata.id" = "$rootUri/v1.0/users/$TmpValue" } |
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.
$Value = @{ "@odata.id" = "$rootUri/v1.0/users/$TmpValue" } | |
$Value = @{ "@odata.id" = "$rootUri/beta/users/$TmpValue" } |
Bulk Update of root url (https://graph.microsoft.*) for both GA and Beta to pick it from the Context.