-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[App Service] Support managed identity in App Service container #20215
Conversation
Core |
Debug log shows:
|
Hello, Im still seeing this issue with latest version of cli (v2.30) on container app service using system managed identity |
This PR will be released with Azure CLI 2.31.0 on 12/07/2021. |
Unfortunately, this solution doesn't work for Python 3.6: > docker run -it --rm python:3.6
>>> import datetime
>>> datetime.datetime.strptime('12/30/2021 07:53:52 +00:00', '%m/%d/%Y %H:%M:%S %z')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.6/_strptime.py", line 362, in _strptime
(data_string, format))
ValueError: time data '12/30/2021 07:53:52 +00:00' does not match format '%m/%d/%Y %H:%M:%S %z'
>>> datetime.datetime.strptime('12/30/2021 07:53:52 +0000', '%m/%d/%Y %H:%M:%S %z')
datetime.datetime(2021, 12, 30, 7, 53, 52, tzinfo=datetime.timezone.utc) which means https://docs.python.org/3/library/datetime.html#technical-detail
Will work on bumping Python version in #20857. |
# curl "${MSI_ENDPOINT}?resource=https://management.core.windows.net/&api-version=2017-09-01" -H "secret: ${MSI_SECRET}" | ||
# { | ||
# "access_token": "eyJ0eXAiOiJKV...", | ||
# "expires_on":"11/05/2021 15:18:31 +00:00", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example response was retrieved on a Linux App Service.
It has been reported that managed identity on Windows App Service returns expires_on
in a different format:
"expires_on":"8/5/2023 9:13:43 AM +00:00"
causing Azure CLI to fail with
time data '8/3/2023 9:26:33 AM +0000' does not match format '%m/%d/%Y %H:%M:%S %z'
In my opinion, App Service should guarantee the responses of managed identity get token requests targeting the same API version 2017-09-01
are consistent between Windows and Linux.
Description
az login --identity
fails: ValueError: invalid literal for int() with base 10: '11/04/2021 23:46:50 +00:00' #20186For more details, see #19480 (comment)
msrestazure
still uses2017-09-01
for managed identity in App Service container. The returnedexpires_on
is a datetime string like"11/05/2021 15:18:31 +00:00"
. This differs fromexpires_on
returned by managed identity on Azure VM:"1605238724"
"11/05/2021 15:18:31 +00:00"
As it is not possible to update
msrestazure
to use the latest2019-08-01
managed identity endpoint, becausemsrestazure
has been out of maintenance. Azure CLI needs to be able to handle such inconsistency in order to support managed identity in App Service container.Testing Guide
mcr.microsoft.com/appsvc/staticsite:latest