Access token for Azure Valid only for 1 hour
See original GitHub issueSteps to reproduce
Hi @isaiahwilliams I am looking for some guidance. We are using the secure model for partner center but with Azure.
To login to Azure we have the following code:
$azureTokenParameters = @{
RefreshToken = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($azRefreshTokenSecure))
Scopes = 'https://management.azure.com/user_impersonation'
Credential = $azCredential
ApplicationId = ''
TenantId = ''
ServicePrincipal = $true
ErrorAction = 'Stop'
}
$azureToken = New-PartnerAccessToken @azureTokenParameters
The returned access token we use in Connect-AzAccount. The return access token is valid only for 1 hour though. I have tried doing this: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes#cmdlet-reference
The policy that is set is:
$policyDefinition = @('{
"TokenLifetimePolicy":
{
"Version":1,
"AccessTokenLifetime":"23:00:00"
}
}')
Setting AccessTokenLifetime to higher value specifically for the application and for the service principal of the application. Assigning the policy even to both of them does not work as I still get access token of 1 hour with the above command. Can you help us? We need to have access token for longer than one hour because we have workflows that run more than 1 hour. How to do this with the secure model for partner center?
What steps can reproduce the defect? Please share the setup, commandline for vstest.console, sample project, target framework etc.
Expected behavior
Share the expected output
Actual behavior
What is the behavior observed?
Diagnostic logs
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.
Environment
Please share additional details about your environment. Version
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
@isaiahwilliams I was asking more to reach to that team as representative for the of the partners. Last time when I had to convince them to retain non-interactive user authentication I had to battle with them for weeks until they can understand how critical is this for CSP. It is important that there is some collaboration on such initiatives inside Microsoft as my experience shows when I try to reach to multiple groups to solve issue turns into failure unfortunately.
@slavizh both the Azure and Partner Center modules use a similar strategy for authentication, which means it would not be too difficult add this ability. I know there has been discussions about this topic within the Azure PowerShell team, but I am not aware of any immediate plans. Fortunately that module is open source, so if the team behind module is not planning to add this feature hopefully the community can. Let me see if there is anything additional I can track down.