Open
Description
Task name
AzurePowerShell
Task version
5
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows
Question
Hello.
One step of the pipeline is to deploy the application and the AzurePowerShell@task is used for that.
`azureSubscription` is provided and being used to access/deploy to the resources in subscription.
During the deployment we do:
`New-AzStorageContext -StorageAccountName <accountName> -UseConnectedAccount` to get the storage account context with the connected account so it would start using OAuth to authenticate.
However depending on the time when the command is called it fails or not.
There are two scenarios:
- 1
- On start of pipeline create context
- sleep for 30 minutes
- create context
- access resource
- 2
- sleep for 30 minutes
- create context
- access resource
The scenario 1 works without problem.
Scenario 2 fails everytime with:
`Failed to fetch storage account context: ClientAssertionCredential authentication failed: `
Could you please share if this is something expected?
I assume this is related to the token lifetime, if so how do I reauthenticate again within the same script?
Thank you in advance!