Is there any option to get azure access token by using only
subscription id?
You can't do it because a user gets authenticated and authorized before accessing an Azure Subscription and information about a user is stored in Azure AD.
Is any option create life time access token in azure portal and use
that token in code?
You can't do that either. Maximum duration for which an access token can be valid is 1 day (minimum is 10 minutes and default is 1 hour). You can read more about token lifetime here: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes.
Try it
button? – Joy Wang-MSFTIs any option create life time access token in azure portal and use that token in code?
- Why do you want to do that? I am just curious to know your use case. Please edit your question and explain the use case. There may be some viable alternatives available. – Gaurav Mantri