Skip to content

Commit ab529e0

Browse files
authored
Updated ServicePrincipalAppRole customizations (#1161) (#1162)
1 parent 65cddad commit ab529e0

6 files changed

+18
-18
lines changed

module/Entra/customizations/Get-EntraServicePrincipalAppRoleAssignedTo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ------------------------------------------------------------------------------
44
@{
55
SourceName = "Get-AzureADServiceAppRoleAssignedTo"
6-
TargetName = "Get-MgServicePrincipalAppRoleAssignment"
6+
TargetName = "Get-MgServicePrincipalAppRoleAssignedTo"
77
Parameters = @(
88
@{
99
SourceName = "ObjectId"

module/Entra/customizations/Get-EntraServicePrincipalAppRoleAssignment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ------------------------------------------------------------------------------
44
@{
55
SourceName = "Get-AzureADServiceAppRoleAssignment"
6-
TargetName = "Get-MgServicePrincipalAppRoleAssignedTo"
6+
TargetName = "Get-MgServicePrincipalAppRoleAssignment"
77
Parameters = @(
88
@{
99
SourceName = "ObjectId"

module/EntraBeta/customizations/Get-EntraBetaServicePrincipalAppRoleAssignedTo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ------------------------------------------------------------------------------
44
@{
55
SourceName = "Get-AzureADServiceAppRoleAssignedTo"
6-
TargetName = "Get-MgBetaServicePrincipalAppRoleAssignment"
6+
TargetName = "Get-MgBetaServicePrincipalAppRoleAssignedTo"
77
Parameters = @(
88
@{
99
SourceName = "ObjectId"

module/EntraBeta/customizations/Get-EntraBetaServicePrincipalAppRoleAssignment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ------------------------------------------------------------------------------
44
@{
55
SourceName = "Get-AzureADServiceAppRoleAssignment"
6-
TargetName = "Get-MgBetaServicePrincipalAppRoleAssignedTo"
6+
TargetName = "Get-MgBetaServicePrincipalAppRoleAssignment"
77
Parameters = @(
88
@{
99
SourceName = "ObjectId"

test/module/Entra/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BeforeAll {
2323
)
2424
}
2525

26-
Mock -CommandName Get-MgServicePrincipalAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra
26+
Mock -CommandName Get-MgServicePrincipalAppRoleAssignedTo -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra
2727
}
2828

2929
Describe "Get-EntraServicePrincipalAppRoleAssignedTo" {
@@ -33,14 +33,14 @@ Describe "Get-EntraServicePrincipalAppRoleAssignedTo" {
3333
$result | Should -Not -BeNullOrEmpty
3434
$result.PrincipalId | should -Be '4d8fcb23-adc7-4d47-9328-2420eb1075ef'
3535

36-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
36+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
3737
}
3838
It "Should execute successfully with Alias" {
3939
$result = Get-EntraServicePrincipalAppRoleAssignedTo -ObjectId "4d8fcb23-adc7-4d47-9328-2420eb1075ef"
4040
$result | Should -Not -BeNullOrEmpty
4141
$result.PrincipalId | should -Be '4d8fcb23-adc7-4d47-9328-2420eb1075ef'
4242

43-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
43+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
4444
}
4545
It "Should fail when ServicePrincipalId is empty" {
4646
{ Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*"
@@ -52,13 +52,13 @@ Describe "Get-EntraServicePrincipalAppRoleAssignedTo" {
5252
$result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -All
5353
$result | Should -Not -BeNullOrEmpty
5454

55-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
55+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
5656
}
5757
It "Should return top app role assignments " {
5858
$result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -top 1
5959
$result | Should -Not -BeNullOrEmpty
6060

61-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
61+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
6262
}
6363
It "Should fail when Top is empty" {
6464
{ Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef" -Top } | Should -Throw "Missing an argument for parameter 'Top'*"
@@ -71,7 +71,7 @@ Describe "Get-EntraServicePrincipalAppRoleAssignedTo" {
7171
$result.ObjectID | should -Be "I8uPTcetR02TKCQg6xB170ZWgaqJluBEqPHHxTxJ9Hs"
7272
}
7373
It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" {
74-
Mock -CommandName Get-MgServicePrincipalAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra
74+
Mock -CommandName Get-MgServicePrincipalAppRoleAssignedTo -MockWith {$args} -ModuleName Microsoft.Graph.Entra
7575

7676
$result = Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef"
7777
$params = Get-Parameters -data $result
@@ -83,7 +83,7 @@ Describe "Get-EntraServicePrincipalAppRoleAssignedTo" {
8383
$result= Get-EntraServicePrincipalAppRoleAssignedTo -ServicePrincipalId "4d8fcb23-adc7-4d47-9328-2420eb1075ef"
8484
$result | Should -Not -BeNullOrEmpty
8585
$userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignedTo"
86-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter {
86+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter {
8787
$Headers.'User-Agent' | Should -Be $userAgentHeaderValue
8888
$true
8989
}

test/module/Entra/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BeforeAll {
2323
)
2424
}
2525

26-
Mock -CommandName Get-MgServicePrincipalAppRoleAssignedTo -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra
26+
Mock -CommandName Get-MgServicePrincipalAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra
2727
}
2828

2929
Describe "Get-EntraServiceAppRoleAssigned" {
@@ -33,14 +33,14 @@ Describe "Get-EntraServiceAppRoleAssigned" {
3333
$result | Should -Not -BeNullOrEmpty
3434
$result.ResourceId | should -Be '021510b7-e753-40aa-b668-29753295ca34'
3535

36-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
36+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
3737
}
3838
It "Should execute successfully with Alias" {
3939
$result = Get-EntraServicePrincipalAppRoleAssignment -ObjectId "021510b7-e753-40aa-b668-29753295ca34"
4040
$result | Should -Not -BeNullOrEmpty
4141
$result.ResourceId | should -Be '021510b7-e753-40aa-b668-29753295ca34'
4242

43-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
43+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
4444
}
4545
It "Should fail when ServicePrincipalId is empty" {
4646
{ Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*"
@@ -52,14 +52,14 @@ Describe "Get-EntraServiceAppRoleAssigned" {
5252
$result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -All
5353
$result | Should -Not -BeNullOrEmpty
5454

55-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
55+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
5656
}
5757

5858
It "Should return top service principal application role assignment." {
5959
$result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -top 1
6060
$result | Should -Not -BeNullOrEmpty
6161

62-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1
62+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1
6363
}
6464
It "Should fail when Top is empty" {
6565
{ Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34" -Top } | Should -Throw "Missing an argument for parameter 'Top'*"
@@ -72,7 +72,7 @@ Describe "Get-EntraServiceAppRoleAssigned" {
7272
$result.ObjectId | should -Be "qjltmaz9l02qPcgftHNirITXiOnmHR5GmW_oEXl_ZL8"
7373
}
7474
It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" {
75-
Mock -CommandName Get-MgServicePrincipalAppRoleAssignedTo -MockWith {$args} -ModuleName Microsoft.Graph.Entra
75+
Mock -CommandName Get-MgServicePrincipalAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra
7676

7777
$result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34"
7878
$params = Get-Parameters -data $result
@@ -84,7 +84,7 @@ Describe "Get-EntraServiceAppRoleAssigned" {
8484
$result = Get-EntraServicePrincipalAppRoleAssignment -ServicePrincipalId "021510b7-e753-40aa-b668-29753295ca34"
8585
$result | Should -Not -BeNullOrEmpty
8686
$userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalAppRoleAssignment"
87-
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignedTo -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter {
87+
Should -Invoke -CommandName Get-MgServicePrincipalAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter {
8888
$Headers.'User-Agent' | Should -Be $userAgentHeaderValue
8989
$true
9090
}

0 commit comments

Comments
 (0)