Skip to content

ManagedIdentityCredential cannot parse expires_on from App Service for Windows #9393

@jianghaolu

Description

@jianghaolu

In https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/identity/azure-identity/azure/identity/_authn_client.py#L138

The format to parse the expires_on field is m/%d/%Y %H:%M:%S, however, 2017-09-01 version of managed identity service on App Services for Windows returns a payload with date times formatted as "expires_on":"1/10/2020 8:01:28 AM +00:00", which results in error:

Traceback (most recent call last):
  File "app.py", line 4, in <module>
    parsed = time.strptime(expires_on[: -len(" +00:00")], "%m/%d/%Y %H:%M:%S")
  File "/usr/lib/python3.6/_strptime.py", line 559, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "/usr/lib/python3.6/_strptime.py", line 365, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains:  AM

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions