microsoft / Partner-Center-PowerShell

PowerShell module for managing Partner Center resources.
https://docs.microsoft.com/powershell/partnercenter/
MIT License
130 stars 59 forks source link

New-PartnerCustomer always gives error after address validation #383

Open jduartedj opened 2 years ago

jduartedj commented 2 years ago

Steps to reproduce

What steps can reproduce the defect?

call the New-PartnerCustomer command with any valid parameters (used the example and many others)

Please share the setup, command line for vstest.console, sample project, target framework etc.

Tried with module V2 and V3

Expected behavior

Share the expected output

Customer Object

Actual behavior

What is the behavior observed?

error is thrown

New-PartnerCustomer : Unexpected character encountered while parsing value: {. Path '', line 1, position 1.
At line:1 char:8
+ $new = New-PartnerCustomer -BillingAddressLine1 'MyHome, 1' -BillingA ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-PartnerCustomer], JsonReaderException
    + FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomer
## Diagnostic logs

Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.


PS C:\Users\duribeir> $new = New-PartnerCustomer -BillingAddressLine1 'MyHome, 1' -BillingAddressCity 'Lisboa' -BillingAddressCountry 'PT' -BillingAddressPostalCode '1200-168' -ContactEmail 'jdoe@customer.com' -ContactFirstName 'Jane' -ContactLastName 'Doe' -Culture 'en-US' -Domain 'RndmCustmrTest159.onmicrosoft.com' -Language 'en' -Name 'New Customer T' -Debug
DEBUG: [AccessTokenAuthenticator] The specified access token expires at 12/15/2021 2:18:49 PM
DEBUG: [AccessTokenAuthenticator] The specified access token expires at 12/15/2021 2:18:49 PM
DEBUG: [AccessTokenAuthenticator] Constructing the authentication result based on the specified access token
DEBUG: [AccessTokenAuthenticator] Constructing the authentication result based on the specified access token
DEBUG: [AccessTokenAuthenticator] The UPN claim value is Duarte.Ribeirinho@csp4demo.onmicrosoft.com
DEBUG: [AccessTokenAuthenticator] The UPN claim value is Duarte.Ribeirinho@csp4demo.onmicrosoft.com
DEBUG: [AccessTokenAuthenticator] Constructing the resource account value based on specified access token
DEBUG: [AccessTokenAuthenticator] Constructing the resource account value based on specified access token
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
HEAD

Absolute Uri: https://api.partnercenter.microsoft.com/v1/domains/RndmCustmrTest159.onmicrosoft.com

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : 807c9ce9-366b-4ed4-9034-fd29ca8369ae MS-SdkVersion : 1.15.6.0

DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: HEAD

Absolute Uri: https://api.partnercenter.microsoft.com/v1/domains/RndmCustmrTest159.onmicrosoft.com

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : 807c9ce9-366b-4ed4-9034-fd29ca8369ae MS-SdkVersion : 1.15.6.0

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: NotFound

Headers: Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : 807c9ce9-366b-4ed4-9034-fd29ca8369ae X-Locale : en-US X-ServiceFabric : ResourceNotFound X-Cache : CONFIG_NOCACHE X-Azure-Ref : 0vfG5YQAAAACNjKkBi6jORonT5JZQpuFiTU5aMjIxMDYwNjExMDIxAGE3OTU2NjE5LTE5Y2QtNDYzMy05NzhjLTY0ZGFhNWFjOWZmYw== Date : Wed, 15 Dec 2021 13:46:36 GMT

Body:

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: NotFound

Headers: Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : 807c9ce9-366b-4ed4-9034-fd29ca8369ae X-Locale : en-US X-ServiceFabric : ResourceNotFound X-Cache : CONFIG_NOCACHE X-Azure-Ref : 0vfG5YQAAAACNjKkBi6jORonT5JZQpuFiTU5aMjIxMDYwNjExMDIxAGE3OTU2NjE5LTE5Y2QtNDYzMy05NzhjLTY0ZGFhNWFjOWZmYw== Date : Wed, 15 Dec 2021 13:46:36 GMT

Body:

DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: GET

Absolute Uri: https://api.partnercenter.microsoft.com/v1/countryvalidationrules/PT

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : e4541c2f-be02-49c0-ad53-f8db984a9235 MS-SdkVersion : 1.15.6.0

DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: GET

Absolute Uri: https://api.partnercenter.microsoft.com/v1/countryvalidationrules/PT

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : e4541c2f-be02-49c0-ad53-f8db984a9235 MS-SdkVersion : 1.15.6.0

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK

Headers: MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : e4541c2f-be02-49c0-ad53-f8db984a9235 MS-CV : FOoCC1KhCUCrPcjQ.0 MS-ServerId : 000012 Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f Date : Wed, 15 Dec 2021 13:46:36 GMT

Body: { "iso2Code": "PT", "defaultCulture": "pt-PT", "isStateRequired": false, "supportedStatesList": [], "supportedLanguagesList": [ "en", "pt-PT" ], "supportedCulturesList": [ "pt-PT", "en-US" ], "isPostalCodeRequired": true, "postalCodeRegex": "^\d{4}(-\d{3})?$", "isCityRequired": true, "isVatIdSupported": true, "taxIdFormat": "PT#########", "taxIdSample": "PT980152267", "vatIdRegex": "^PT[\d]{9,9}$", "isTaxIdSupported": false, "isTaxIdOptional": false, "countryCallingCodesList": [ "351" ], "attributes": { "objectType": "CountryValidationRules" } }

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK

Headers: MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : e4541c2f-be02-49c0-ad53-f8db984a9235 MS-CV : FOoCC1KhCUCrPcjQ.0 MS-ServerId : 000012 Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f Date : Wed, 15 Dec 2021 13:46:36 GMT

Body: { "iso2Code": "PT", "defaultCulture": "pt-PT", "isStateRequired": false, "supportedStatesList": [], "supportedLanguagesList": [ "en", "pt-PT" ], "supportedCulturesList": [ "pt-PT", "en-US" ], "isPostalCodeRequired": true, "postalCodeRegex": "^\d{4}(-\d{3})?$", "isCityRequired": true, "isVatIdSupported": true, "taxIdFormat": "PT#########", "taxIdSample": "PT980152267", "vatIdRegex": "^PT[\d]{9,9}$", "isTaxIdSupported": false, "isTaxIdOptional": false, "countryCallingCodesList": [ "351" ], "attributes": { "objectType": "CountryValidationRules" } }

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

Absolute Uri: https://api.partnercenter.microsoft.com/v1/validations/address

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : 021e08d4-5b42-423a-8107-ca0cb9902554 MS-SdkVersion : 1.15.6.0

Body: { "AddressLine1": "MyHome, 1", "City": "Lisboa", "Country": "PT", "FirstName": "Jane", "LastName": "Doe", "PostalCode": "1200-168" }

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

Absolute Uri: https://api.partnercenter.microsoft.com/v1/validations/address

Headers: Accept : application/json MS-PartnerCenter-Client : Partner Center PowerShell MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 X-Locale : en-US MS-RequestId : 021e08d4-5b42-423a-8107-ca0cb9902554 MS-SdkVersion : 1.15.6.0

Body: { "AddressLine1": "MyHome, 1", "City": "Lisboa", "Country": "PT", "FirstName": "Jane", "LastName": "Doe", "PostalCode": "1200-168" }

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK

Headers: Transfer-Encoding : chunked Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : 021e08d4-5b42-423a-8107-ca0cb9902554 X-Locale : en-US X-Cache : CONFIG_NOCACHE X-Azure-Ref : 0vfG5YQAAAAA66aeQzxIpQYllZVCnx+inQk4zRURHRTExMTYAYTc5NTY2MTktMTljZC00NjMzLTk3OGMtNjRkYWE1YWM5ZmZj Date : Wed, 15 Dec 2021 13:46:37 GMT

Body: { "originalAddress": { "country": "PT", "city": "Lisboa", "addressLine1": "MyHome, 1", "postalCode": "1200-168" }, "suggestedAddresses": [], "status": "Verified" }

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK

Headers: Transfer-Encoding : chunked Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f MS-CorrelationId : 1bf19f1d-8d07-4c8b-9085-647a97910641 MS-RequestId : 021e08d4-5b42-423a-8107-ca0cb9902554 X-Locale : en-US X-Cache : CONFIG_NOCACHE X-Azure-Ref : 0vfG5YQAAAAA66aeQzxIpQYllZVCnx+inQk4zRURHRTExMTYAYTc5NTY2MTktMTljZC00NjMzLTk3OGMtNjRkYWE1YWM5ZmZj Date : Wed, 15 Dec 2021 13:46:37 GMT

Body: { "originalAddress": { "country": "PT", "city": "Lisboa", "addressLine1": "MyHome, 1", "postalCode": "1200-168" }, "suggestedAddresses": [], "status": "Verified" }

New-PartnerCustomer : Unexpected character encountered while parsing value: {. Path '', line 1, position 1. At line:1 char:8

Environment

Please share additional details about your environment.

Tested on sandbox and a prod environment With a global admin and a billing admin Tested on different tenants Tested different addresses for different countries

Version

tested with 2 and 3

mprentice22153 commented 2 years ago

This might be the same as issue https://github.com/microsoft/Partner-Center-PowerShell/issues/367