setting-android-enterprise-wi-fi-policy-"connectautomatically"-to-true-via-graph

Setting Android Enterprise Wi-Fi policy "ConnectAutomatically" to TRUE via GRAPH

Hi,

I’ve really struggling to adjust a setting that’s not viewable via the Endpoint Manager admin Center.
After looking at some samples here – powershell-intune-samples/DeviceConfiguration_Get.ps1 at master · microsoftgraph/powershell-intune-samples · GitHub I am able to view the attributes but can for the life of me work out how to PATCH or change the settings as outlined here – Update androidWorkProfileWiFiConfiguration – Microsoft Graph beta | Microsoft Docs

Has anyone managed to do this?

 

 

$uri = “https://graph.microsoft.com/Beta/deviceManagement/deviceConfigurations/Loooooong reference ID to our Wifi policy ID”
Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get

@odata.context : https://graph.microsoft.com/beta/$metadata#deviceManagement/deviceConfigurations/$entity
@odata.type : #microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration
id : Loooooong reference ID to our Wifi policy ID
lastModifiedDateTime : 2022-01-12T09:29:09.8945527Z
roleScopeTagIds : {0}
supportsScopeTags : True
deviceManagementApplicabilityRuleOsEdition :
deviceManagementApplicabilityRuleOsVersion :
deviceManagementApplicabilityRuleDeviceMode :
createdDateTime : 2021-11-08T16:46:28.0046415Z
description :
displayName : Android Enterprise – Wi-Fi -Managed
version : 14
networkName : Another looooong number
ssid : wifi-Managed
connectAutomatically : False
connectWhenNetworkNameIsHidden : True
wiFiSecurityType : wpaEnterprise
preSharedKey :
preSharedKeyIsSet : False
eapType : eapTls
trustedServerCertificateNames : {server.ourdomain.com}
authenticationMethod : certificate
innerAuthenticationProtocolForEapTtls :
innerAuthenticationProtocolForPeap : none
outerIdentityPrivacyTemporaryValue : OurDeviceName

$Body = @{“connectAutomatically” = “True”}

Invoke-RestMethod -Method PATCH -Uri $uri -Body $Body -Headers $authToken -ContentType application/json

Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Invoke-RestMethod -Method PATCH -Uri $uri -Body $Body -Headers $authT …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

 

 

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *