Skip to content

Commit d2e070b

Browse files
SteveMutungi254KenitoInc
authored andcommitted
[Modularize] Usability - Replacing ObjectId with specific <resource>Id (#1322)
1 parent ae16169 commit d2e070b

File tree

114 files changed

+2655
-3144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2655
-3144
lines changed

module/Entra/Microsoft.Entra/Applications/Get-EntraApplicationKeyCredential.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ function Get-EntraApplicationKeyCredential {
66
[CmdletBinding(DefaultParameterSetName = '')]
77
param (
88

9-
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
10-
[System.String] $ObjectId
9+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
10+
[Alias("ObjectId")]
11+
[System.String] $ApplicationId
1112
)
1213

13-
PROCESS {
14+
PROCESS {
1415
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
15-
(Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ObjectId"]).KeyCredentials
16+
(Get-MgApplication -Headers $customHeaders -ApplicationId $PSBoundParameters["ApplicationId"]).KeyCredentials
1617
}
1718
}
1819

module/Entra/Microsoft.Entra/Applications/Get-EntraServicePrincipalKeyCredential.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
function Get-EntraServicePrincipalKeyCredential {
66
[CmdletBinding(DefaultParameterSetName = '')]
77
param (
8-
[Alias("ObjectId")]
9-
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
10-
[System.String] $ServicePrincipalId
8+
[Alias("ObjectId")]
9+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
10+
[System.String] $ServicePrincipalId
1111
)
1212

1313
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
1414
$response = (Get-MgServicePrincipal -Headers $customHeaders -ServicePrincipalId $PSBoundParameters["ServicePrincipalId"]).KeyCredentials
1515
$response | ForEach-Object {
16-
if($null -ne $_) {
17-
Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime
18-
Add-Member -InputObject $_ -MemberType AliasProperty -Name EndDate -Value EndDateTime
16+
if ($null -ne $_) {
17+
Add-Member -InputObject $_ -MemberType AliasProperty -Name StartDate -Value StartDateTime
18+
Add-Member -InputObject $_ -MemberType AliasProperty -Name EndDate -Value EndDateTime
1919
}
2020
}
2121
$response

module/Entra/Microsoft.Entra/Applications/New-EntraServicePrincipalAppRoleAssignment.ps1

Lines changed: 68 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,100 +6,85 @@ function New-EntraServicePrincipalAppRoleAssignment {
66
[CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')]
77
param (
88

9-
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
10-
[System.String] $PrincipalId,
9+
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
10+
[System.String] $PrincipalId,
1111

12-
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
13-
[System.String] $ResourceId,
12+
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
13+
[System.String] $ResourceId,
1414

15-
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
16-
[System.String] $Id,
15+
[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
16+
[System.String] $Id,
1717

18-
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
19-
[System.String] $ObjectId
18+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
19+
[Alias("ObjectId")]
20+
[System.String] $ServicePrincipalId
2021
)
2122

2223
PROCESS {
23-
$params = @{}
24-
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
24+
$params = @{}
25+
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
2526

26-
if ($null -ne $PSBoundParameters["OutVariable"])
27-
{
28-
$params["OutVariable"] = $PSBoundParameters["OutVariable"]
29-
}
30-
if ($null -ne $PSBoundParameters["PrincipalId"])
31-
{
32-
$params["PrincipalId"] = $PSBoundParameters["PrincipalId"]
33-
}
34-
if($PSBoundParameters.ContainsKey("Debug"))
35-
{
36-
$params["Debug"] = $PSBoundParameters["Debug"]
37-
}
38-
if ($null -ne $PSBoundParameters["PipelineVariable"])
39-
{
40-
$params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"]
41-
}
42-
if ($null -ne $PSBoundParameters["InformationVariable"])
43-
{
44-
$params["InformationVariable"] = $PSBoundParameters["InformationVariable"]
45-
}
46-
if ($null -ne $PSBoundParameters["OutBuffer"])
47-
{
48-
$params["OutBuffer"] = $PSBoundParameters["OutBuffer"]
49-
}
50-
if ($null -ne $PSBoundParameters["ResourceId"])
51-
{
52-
$params["ResourceId"] = $PSBoundParameters["ResourceId"]
53-
}
54-
if ($null -ne $PSBoundParameters["WarningVariable"])
55-
{
56-
$params["WarningVariable"] = $PSBoundParameters["WarningVariable"]
57-
}
58-
if($PSBoundParameters.ContainsKey("Verbose"))
59-
{
60-
$params["Verbose"] = $PSBoundParameters["Verbose"]
61-
}
62-
if ($null -ne $PSBoundParameters["Id"])
63-
{
64-
$params["AppRoleId"] = $PSBoundParameters["Id"]
65-
}
66-
if ($null -ne $PSBoundParameters["ErrorVariable"])
67-
{
68-
$params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"]
69-
}
70-
if ($null -ne $PSBoundParameters["ErrorAction"])
71-
{
72-
$params["ErrorAction"] = $PSBoundParameters["ErrorAction"]
73-
}
74-
if ($null -ne $PSBoundParameters["ObjectId"])
75-
{
76-
$params["ServicePrincipalId"] = $PSBoundParameters["ObjectId"]
77-
}
78-
if ($null -ne $PSBoundParameters["InformationAction"])
79-
{
80-
$params["InformationAction"] = $PSBoundParameters["InformationAction"]
81-
}
82-
if ($null -ne $PSBoundParameters["WarningAction"])
83-
{
84-
$params["WarningAction"] = $PSBoundParameters["WarningAction"]
85-
}
86-
if ($null -ne $PSBoundParameters["ProgressAction"])
87-
{
88-
$params["ProgressAction"] = $PSBoundParameters["ProgressAction"]
89-
}
27+
if ($null -ne $PSBoundParameters["OutVariable"]) {
28+
$params["OutVariable"] = $PSBoundParameters["OutVariable"]
29+
}
30+
if ($null -ne $PSBoundParameters["PrincipalId"]) {
31+
$params["PrincipalId"] = $PSBoundParameters["PrincipalId"]
32+
}
33+
if ($PSBoundParameters.ContainsKey("Debug")) {
34+
$params["Debug"] = $PSBoundParameters["Debug"]
35+
}
36+
if ($null -ne $PSBoundParameters["PipelineVariable"]) {
37+
$params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"]
38+
}
39+
if ($null -ne $PSBoundParameters["InformationVariable"]) {
40+
$params["InformationVariable"] = $PSBoundParameters["InformationVariable"]
41+
}
42+
if ($null -ne $PSBoundParameters["OutBuffer"]) {
43+
$params["OutBuffer"] = $PSBoundParameters["OutBuffer"]
44+
}
45+
if ($null -ne $PSBoundParameters["ResourceId"]) {
46+
$params["ResourceId"] = $PSBoundParameters["ResourceId"]
47+
}
48+
if ($null -ne $PSBoundParameters["WarningVariable"]) {
49+
$params["WarningVariable"] = $PSBoundParameters["WarningVariable"]
50+
}
51+
if ($PSBoundParameters.ContainsKey("Verbose")) {
52+
$params["Verbose"] = $PSBoundParameters["Verbose"]
53+
}
54+
if ($null -ne $PSBoundParameters["Id"]) {
55+
$params["AppRoleId"] = $PSBoundParameters["Id"]
56+
}
57+
if ($null -ne $PSBoundParameters["ErrorVariable"]) {
58+
$params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"]
59+
}
60+
if ($null -ne $PSBoundParameters["ErrorAction"]) {
61+
$params["ErrorAction"] = $PSBoundParameters["ErrorAction"]
62+
}
63+
if ($null -ne $PSBoundParameters["ServicePrincipalId"]) {
64+
$params["ServicePrincipalId"] = $PSBoundParameters["ServicePrincipalId"]
65+
}
66+
if ($null -ne $PSBoundParameters["InformationAction"]) {
67+
$params["InformationAction"] = $PSBoundParameters["InformationAction"]
68+
}
69+
if ($null -ne $PSBoundParameters["WarningAction"]) {
70+
$params["WarningAction"] = $PSBoundParameters["WarningAction"]
71+
}
72+
if ($null -ne $PSBoundParameters["ProgressAction"]) {
73+
$params["ProgressAction"] = $PSBoundParameters["ProgressAction"]
74+
}
9075

91-
Write-Debug("============================ TRANSFORMATIONS ============================")
92-
$params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug
93-
Write-Debug("=========================================================================`n")
76+
Write-Debug("============================ TRANSFORMATIONS ============================")
77+
$params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug
78+
Write-Debug("=========================================================================`n")
9479

95-
$response = New-MgServicePrincipalAppRoleAssignment @params -Headers $customHeaders
96-
$response | ForEach-Object {
97-
if($null -ne $_) {
98-
Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id
80+
$response = New-MgServicePrincipalAppRoleAssignment @params -Headers $customHeaders
81+
$response | ForEach-Object {
82+
if ($null -ne $_) {
83+
Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id
9984

85+
}
10086
}
101-
}
102-
$response
87+
$response
10388
}
10489
}
10590

module/Entra/Microsoft.Entra/Applications/Remove-EntraApplicationPassword.ps1

Lines changed: 58 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,86 +6,73 @@ function Remove-EntraApplicationPassword {
66
[CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')]
77
param (
88

9-
[Parameter(ParameterSetName = "InvokeByDynamicParameters")]
10-
[System.String] $KeyId,
9+
[Parameter(ParameterSetName = "InvokeByDynamicParameters")]
10+
[System.String] $KeyId,
1111

12-
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
13-
[System.String] $ObjectId
12+
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
13+
[Alias("ObjectId")]
14+
[System.String] $ApplicationId
1415
)
1516

1617
PROCESS {
17-
$params = @{}
18-
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
18+
$params = @{}
19+
$customHeaders = New-EntraCustomHeaders -Command $MyInvocation.MyCommand
1920

20-
if ($null -ne $PSBoundParameters["OutVariable"])
21-
{
22-
$params["OutVariable"] = $PSBoundParameters["OutVariable"]
23-
}
24-
if($PSBoundParameters.ContainsKey("Debug"))
25-
{
26-
$params["Debug"] = $PSBoundParameters["Debug"]
27-
}
28-
if ($null -ne $PSBoundParameters["PipelineVariable"])
29-
{
30-
$params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"]
31-
}
32-
if ($null -ne $PSBoundParameters["InformationVariable"])
33-
{
34-
$params["InformationVariable"] = $PSBoundParameters["InformationVariable"]
35-
}
36-
if ($null -ne $PSBoundParameters["OutBuffer"])
37-
{
38-
$params["OutBuffer"] = $PSBoundParameters["OutBuffer"]
39-
}
40-
if ($null -ne $PSBoundParameters["WarningVariable"])
41-
{
42-
$params["WarningVariable"] = $PSBoundParameters["WarningVariable"]
43-
}
44-
if($PSBoundParameters.ContainsKey("Verbose"))
45-
{
46-
$params["Verbose"] = $PSBoundParameters["Verbose"]
47-
}
48-
if ($null -ne $PSBoundParameters["ErrorVariable"])
49-
{
50-
$params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"]
51-
}
52-
if ($null -ne $PSBoundParameters["KeyId"])
53-
{
54-
$params["KeyId"] = $PSBoundParameters["KeyId"]
55-
}
56-
if ($null -ne $PSBoundParameters["ErrorAction"])
57-
{
58-
$params["ErrorAction"] = $PSBoundParameters["ErrorAction"]
59-
}
60-
if ($null -ne $PSBoundParameters["ObjectId"])
61-
{
62-
$params["ApplicationId"] = $PSBoundParameters["ObjectId"]
63-
}
64-
if ($null -ne $PSBoundParameters["InformationAction"])
65-
{
66-
$params["InformationAction"] = $PSBoundParameters["InformationAction"]
67-
}
68-
if ($null -ne $PSBoundParameters["WarningAction"])
69-
{
70-
$params["WarningAction"] = $PSBoundParameters["WarningAction"]
71-
}
72-
if ($null -ne $PSBoundParameters["ProgressAction"])
73-
{
74-
$params["ProgressAction"] = $PSBoundParameters["ProgressAction"]
75-
}
21+
if ($null -ne $PSBoundParameters["OutVariable"]) {
22+
$params["OutVariable"] = $PSBoundParameters["OutVariable"]
23+
}
24+
if ($PSBoundParameters.ContainsKey("Debug")) {
25+
$params["Debug"] = $PSBoundParameters["Debug"]
26+
}
27+
if ($null -ne $PSBoundParameters["PipelineVariable"]) {
28+
$params["PipelineVariable"] = $PSBoundParameters["PipelineVariable"]
29+
}
30+
if ($null -ne $PSBoundParameters["InformationVariable"]) {
31+
$params["InformationVariable"] = $PSBoundParameters["InformationVariable"]
32+
}
33+
if ($null -ne $PSBoundParameters["OutBuffer"]) {
34+
$params["OutBuffer"] = $PSBoundParameters["OutBuffer"]
35+
}
36+
if ($null -ne $PSBoundParameters["WarningVariable"]) {
37+
$params["WarningVariable"] = $PSBoundParameters["WarningVariable"]
38+
}
39+
if ($PSBoundParameters.ContainsKey("Verbose")) {
40+
$params["Verbose"] = $PSBoundParameters["Verbose"]
41+
}
42+
if ($null -ne $PSBoundParameters["ErrorVariable"]) {
43+
$params["ErrorVariable"] = $PSBoundParameters["ErrorVariable"]
44+
}
45+
if ($null -ne $PSBoundParameters["KeyId"]) {
46+
$params["KeyId"] = $PSBoundParameters["KeyId"]
47+
}
48+
if ($null -ne $PSBoundParameters["ErrorAction"]) {
49+
$params["ErrorAction"] = $PSBoundParameters["ErrorAction"]
50+
}
51+
if ($null -ne $PSBoundParameters["ApplicationId"]) {
52+
$params["ApplicationId"] = $PSBoundParameters["ApplicationId"]
53+
}
54+
if ($null -ne $PSBoundParameters["InformationAction"]) {
55+
$params["InformationAction"] = $PSBoundParameters["InformationAction"]
56+
}
57+
if ($null -ne $PSBoundParameters["WarningAction"]) {
58+
$params["WarningAction"] = $PSBoundParameters["WarningAction"]
59+
}
60+
if ($null -ne $PSBoundParameters["ProgressAction"]) {
61+
$params["ProgressAction"] = $PSBoundParameters["ProgressAction"]
62+
}
7663

77-
Write-Debug("============================ TRANSFORMATIONS ============================")
78-
$params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug
79-
Write-Debug("=========================================================================`n")
64+
Write-Debug("============================ TRANSFORMATIONS ============================")
65+
$params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug
66+
Write-Debug("=========================================================================`n")
8067

81-
$response = Remove-MgApplicationPassword @params -Headers $customHeaders
82-
$response | ForEach-Object {
83-
if($null -ne $_) {
84-
Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id
68+
$response = Remove-MgApplicationPassword @params -Headers $customHeaders
69+
$response | ForEach-Object {
70+
if ($null -ne $_) {
71+
Add-Member -InputObject $_ -MemberType AliasProperty -Name ObjectId -Value Id
8572

73+
}
8674
}
87-
}
88-
$response
75+
$response
8976
}
9077
}
9178

0 commit comments

Comments
 (0)