Describe the bug
Hey,
I think this is a bug, but maybe it's a misunderstanding from me.
Bug
When creating a secret for an Azure AD app using add_password.post() and a PasswordCredential object, fields such as displayName, startDateTime, and endDateTime are silently ignored. The resulting secret is created with an empty name and a default expiration of 2 years.
Actual behavior
- Secret is created with no name
- Secret expires 2 years from creation (default)
Expected behavior
- Secret is created with displayName "Secret Test 2025"
- Secret expires on the specified endDateTime
How to reproduce
from msgraph.generated.models import PasswordCredential
now = datetime.datetime.now(datetime.timezone.utc)
end = now + datetime.timedelta(days=365)
cred = PasswordCredential(
display_name="Secret Test 2025",
start_date_time=now,
end_date_time=end
)
await client.applications.by_application_id(app_id).add_password.post(cred)
SDK Version
msgraph-sdk-python 1.26.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
Request method: 'POST'
Request headers:
'Accept': 'application/json'
'User-Agent': 'azsdk-python-identity/1.21.0 Python/3.12.9 (Windows 11)'
A body is sent with the request
Response status: 200
Response headers:
'Content-Type': 'application/json; charset=utf-8'
'x-ms-request-id': '<REDACTED>'
'Date': 'Mon, 14 Apr 2025 09:08:45 GMT'
'Content-Length': '1801'
ClientSecretCredential.get_token succeeded
HTTP Request: POST https://graph.microsoft.com/v1.0/applications/<app_id>/addPassword "HTTP/2 200 OK"
Executed 'Functions.create_secret' (Succeeded, Id=<REDACTED>, Duration=1672ms)
Configuration
- OS: Windows 11
- Architecture: x64
- Configuration has no impact
Other information
No response
Describe the bug
Hey,
I think this is a bug, but maybe it's a misunderstanding from me.
Bug
When creating a secret for an Azure AD app using add_password.post() and a PasswordCredential object, fields such as displayName, startDateTime, and endDateTime are silently ignored. The resulting secret is created with an empty name and a default expiration of 2 years.
Actual behavior
Expected behavior
How to reproduce
SDK Version
msgraph-sdk-python 1.26.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
Configuration
Other information
No response