Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Get-PartnerCustomerDevice does not return assigned Policies on devices #271

Closed
Crille77 opened this issue Jan 30, 2020 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@Crille77
Copy link

I have imported new computers using New-PartnerCustomerDeviceBatch without specifying any Policy since the customer has configured that to be applied automaticly . I can see that this works when looking in PartnerCenter or in the debug output of Get-PartnerCustomerDevice.

When I issue the command Get-PartnerCustomerDevice to get all the imported computers in the batch, I dont get the Policies property set! I have used the command using -debug and there I can see that the Policy value is shown in the output but it doesn't get returned.

$device = Get-PartnerCustomerDevice -CustomerId $CustomerID -BatchId $Batch -Debug

Debug output:
Body:
{
"totalCount": 1,
"items": [
{
"id": "XXXX",
"serialNumber": "XXX",
"modelName": "XXX",
"oemManufacturerName": "XXX",
"policies": [
{
"key": "o_o_b_e",
"value": "AzureAD Join Default Profile"
}
],

"uploadedDate": "2020-01-30T09:10:33.2417951+01:00",
"attributes": {
"objectType": "Device"
}
}
],
"links": {},
"attributes": {
"objectType": "Collection"
}
}

Verifying returned object values:
$device | select *

AllowedOperations :
DeviceId : XXXX
HardwareHash :
ModelName : XXX
OemManufacturerName : XXX
Policies :
ProductKey :
SerialNumber : XXX
UploadedDate : 2020-01-30 08:10:33

As you can see, the value of Policies is empty...

@ghost ghost mentioned this issue Jan 30, 2020
@ghost ghost self-assigned this Jan 30, 2020
@ghost ghost added the bug Something isn't working label Jan 30, 2020
@ghost
Copy link

ghost commented Jan 30, 2020

@Crille77 thank you for sharing this with us. The required code changes to address this issue have been made. Right now I do not have an exact time frame for the next release, but I can grantee that this will be included in version 3.0.7

@Crille77
Copy link
Author

Crille77 commented Feb 3, 2020

Thanks for fixing the bug in the upcoming release!
We are going to have a huge rollout for a customer within a week or so and would really need this thing to work at that time so we can see whether the computer have recieved a policy or not.
Do you have a timeframe for the next release? Will it be in a day or two??? ;-) (Or would it be possible for you to send me a fixed version that we can use until you release it public?)

@ghost
Copy link

ghost commented Feb 4, 2020

@Crille77 currently there is not a timeframe for the next release. However, if you are interested you can download the artifact from the build that happened when the code changes I made were merged. You can find the artifact here.

@Crille77
Copy link
Author

Crille77 commented Feb 5, 2020

Hi!
I downloaded the artifact and unzip'ed the files in an empty directory (D:\temp\pc). Then I unloaded the old ParnterCenter Module. After that was done, I changed directory of my PS session to the PartnerCenter Artifact directory (D:\temp\pc) and there I imported the module by import-module .\PartnerCenter.psm1.
After that is done, I verified that the module was loaded. In the output, I can see that the version is 0.0 and that it is loaded from the correct directory.

get-module PartnerCenter | select ModuleType, Version, Name, ModuleBase, Path

ModuleType : Script
Version    : 0.0
Name       : PartnerCenter
ModuleBase : D:\temp\pc
Path       : D:\temp\pc\PartnerCenter.psm1

If I now tries to verify the Policy-value again, I end up in getting the same bad result...

$dev =Get-PartnerCustomerDevice -CustomerId $SelectedCustomer.CustomerID -BatchId "XXX" -Debug
DEBUG: [AccessTokenAuthenticator] The specified access token expires at 2020-02-05 08:55:27
DEBUG: [AccessTokenAuthenticator] Constructing the authentication result based on the specified access token
DEBUG: [AccessTokenAuthenticator] The UPN claim value is X@X.se
DEBUG: [AccessTokenAuthenticator] Constructing the resource account value based on specified access token
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET

Absolute Uri:
https://api.partnercenter.microsoft.com/v1/customers/XXXXXXXX/deviceBatches/XXX/devices

Headers:
Accept                        : application/json
MS-PartnerCenter-Client       : Partner Center PowerShell
MS-CorrelationId              : X
X-Locale                      : en-US
MS-RequestId                  : X
MS-SdkVersion                 : 1.15.6.0
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK

Headers:
MS-CorrelationId              : X
MS-RequestId                  : X
MS-CV                         : X
MS-ServerId                   : X
Request-Context               : appId=cid-v1:03
Date                          : Wed, 05 Feb 2020 08:08:27 GMT

Body:
{
  "totalCount": 1,
  "items": [
    {
      "id": "GUID",
      "serialNumber": "1234567890",
      "modelName": "HP ProDesk 600 G5 Desktop Mini",
      "oemManufacturerName": "HP",
      "policies": [
        {
          "key": "o_o_b_e",
          "value": "AzureAD Join Default Profile"
        }
      ],
      "uploadedDate": "2020-02-03T12:00:49.1484531+01:00",
      "attributes": {
        "objectType": "Device"
      }
    }
  ],
  "links": {},
  "attributes": {
    "objectType": "Collection"
  }
}

$dev.Policies doesn't give me any output and verifying if empty confirms it not being set and the debug output still outputs the correct info that should be in that variable...

!$dev.Policies
True

Do you have any other suggestions??? Am I doing something wrong??

@Crille77
Copy link
Author

Crille77 commented Feb 5, 2020

OK... I have had a lot trouble when trying the artifact... I once succeded using it... Most of the times I end up in trouble getting "Sequence contains no matching element" when trying to import a batch.

I have tried both having 3.0.6 installed and loading the artifact using get-module .\PartnerCenter.psm1. I have also tried to replace all the files in my 3.0.6 module directory with the artifact files.

Is there something wrong in the artifact or am I doing something wrong???

Some Debug info:

DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST

Absolute Uri:
https://api.partnercenter.microsoft.com/v1/customers/xxx/deviceBatches

Headers:
Accept                        : application/json
MS-PartnerCenter-Client       : Partner Center PowerShell
MS-CorrelationId              : 382126df-bd9e-4b6b-8077-4831af400712
X-Locale                      : en-US
MS-RequestId                  : aee8cb30-2cc0-494a-adef-37c447afd336
MS-SdkVersion                 : 1.15.6.0

Body:
{
  "BatchId": "xxx",
  "Devices": [
    {
      "ModelName": "HP ProDesk 600 G5 Desktop Mini",
      "OemManufacturerName": "HP",
      "Policies": [],
      "SerialNumber": "xxx",
      "UploadedDate": "0001-01-01T00:00:00Z",
      "Attributes": {
        "ObjectType": "Device"
      }
    }
  ],
  "Attributes": {
    "ObjectType": "DeviceBatchCreationRequest"
  }
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError

Headers:
MS-CorrelationId              : 382126df-bd9e-4b6b-8077-4831af400712
MS-RequestId                  : aee8cb30-2cc0-494a-adef-37c447afd336
MS-CV                         : 3fL0vvIO/kiZKfEl.0
MS-ServerId                   : 0000112D
Request-Context               : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f
Date                          : Wed, 05 Feb 2020 16:17:28 GMT

Body:
{
  "code": 0,
  "description": "Sequence contains no matching element",
  "data": [],
  "source": "PartnerFD"
}

@Crille77
Copy link
Author

Crille77 commented Feb 5, 2020

Update...

I have tested using New-PartnerCustomerDeviceBatch from 3.0.6 and then issued the exact same using the artifact. Version 3.0.6 works perfect but the artifact throws "Sequence contains no matching element" no matter what.

But one positive thing is that after I imported one computer using 3.0.6, I used Get-PartnerCustomerDevice from the artifact version to get the policies and it works! One fix and one more bug...

@Crille77
Copy link
Author

Crille77 commented Feb 9, 2020

Hi @IsaiahWilliams!

Do you have any update regarding bugs? (Fixed bug in Policy & New bug in artifact when trying to upload a new batch).

I would really need a fix for this asap... We will start deployment of 2000+ computers this week where this is quite important to have in place... Is it doable for you to fix the artifact so both uploading a new batch and getting computer policies works in a release or a new artifact quite soon?

TIA /Christian

@ghost ghost mentioned this issue Feb 13, 2020
@ghost
Copy link

ghost commented Feb 14, 2020

@Crille77 version 3.0.7 was just released and it contains a fix for this issue. Please let us know if you have any other issues with the module.

@ghost ghost closed this as completed Feb 14, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant