Skip to content

New-MgPolicyAppManagementPolicy Reports "incomplete object" #3298

Closed
@12Knocksinna

Description

@12Knocksinna

Describe the bug

Trying to create a new custom application management policy object.

Expected behavior

The cmdlet should create a new application management policy object.

How to reproduce

Create payload:

$NewAppPolicyParameters = @{
displayName = "Allow Apps to Use App Secrets"
description = "This policy allows apps within its scope to create new app secrets. It should be assigned to new apps being tested."
IsEnabled = $true
restrictions = @{
passwordCredentials = @(
@{
restrictionType = "passwordAddition"
state = "disabled"
maxLifetime = $null
}
@{
restrictionType = "passwordLifetime"
state = "enabled"
maxLifetime = "P30D"
}
)
}
}

Run cmdlet:
New-MgPolicyAppManagementPolicy -BodyParameter $NewAppPolicyParameters

SDK Version

V2.27

Latest version known to work for scenario above?

V2.26.1

Known Workarounds

Use Graph request.

Debug output

Click to expand log ```

Are you sure you want to perform this action?
Performing the operation "New-MgPolicyAppManagementPolicy_Create" on target "Call remote 'POST /policies/appManagementPolicies' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/policies/appManagementPolicies

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-IE),PowerShell/7.5.0
SdkVersion : graph-powershell/2.27.0
client-request-id : fe344f36-710b-4f58-b16e-7f0c37ee18c9
Accept-Encoding : gzip,deflate,br

Body:
{
"isEnabled": true
}

Note how the payload is trimmed down to just the isenabled property... that's where the problem arises.

</details>


### Configuration

_
Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0_
### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions