provider/azure: adding credential produces error when service principal exists

Bug #1657448 reported by Roger Peppe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Andrew Wilkins
2.2
Fix Released
High
Andrew Wilkins

Bug Description

I did "juju add-credential azure" and after completing the interaction, saw this error:

 12:31:21 ERROR cmd supercommand.go:458 finalizing credential: ad.ServicePrincipalsClient#Create: Failure responding to request: StatusCode=0 -- Original Error: ad: error response cannot be parsed: "\ufeff{\"odata.error\":{\"code\":\"Request_MultipleObjectsWithSameKeyValue\",\"message\":{\"lang\":\"en\",\"value\":\"Another object with the same value for property servicePrincipalNames already exists.\"},\"requestId\":\"46a97035-e286-4d41-8eee-ae33de2f0288\",\"date\":\"2017-01-18T12:31:21\"}}" error: invalid character 'ï' looking for beginning of value
 12:31:21 DEBUG cmd supercommand.go:459 (error details: [{github.com/juju/juju/cmd/juju/cloud/addcredential.go:244: finalizing credential} {github.com/juju/juju/provider/azure/credentials.go:95: } {github.com/juju/juju/provider/azure/internal/azureauth/interactive.go:164: } {github.com/juju/juju/provider/azure/internal/azureauth/interactive.go:218: } {ad.ServicePrincipalsClient#Create: Failure responding to request: StatusCode=0 -- Original Error: ad: error response cannot be parsed: "\ufeff{\"odata.error\":{\"code\":\"Request_MultipleObjectsWithSameKeyValue\",\"message\":{\"lang\":\"en\",\"value\":\"Another object with the same value for property servicePrincipalNames already exists.\"},\"requestId\":\"46a97035-e286-4d41-8eee-ae33de2f0288\",\"date\":\"2017-01-18T12:31:21\"}}" error: invalid character 'ï' looking for beginning of value}])

It looks like an Azure endpoint is producing a BOM that the client code isn't correctly eliding and so the error isn't correctly diagnosed with isMultipleObjectsWithSameKeyValueErr.

This doesn't always happen (I saw 2 failures in 3 tries). I filed https://github.com/Azure/go-autorest/issues/109 for the underlying bug, but we may be able to work around it in the Juju client code.

Changed in juju:
status: New → Triaged
importance: Undecided → Critical
Changed in juju:
assignee: nobody → Andrew Wilkins (axwalk)
milestone: none → 2.1.0
Andrew Wilkins (axwalk)
Changed in juju:
status: Triaged → In Progress
Revision history for this message
Andrew Wilkins (axwalk) wrote :
Andrew Wilkins (axwalk)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
milestone: 2.1.0 → 2.1-rc1
Curtis Hovey (sinzui)
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.