Open prateekprshr-nith opened 1 year ago
Hi @prateekprshr-nith Ultimately we recommend signing in using service principals / managed identities for best the security, but to answer your questions:
Connect-AzAccount -AccessToken <ARM token> -AttestationAccessToken <attestation token>
.Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anilba06.
Currently the only workaround is to send the request via "Invoke-WebRequest". You can configure the header to include the attestation token for authentication. But the downside is that it's a general purpose cmdlet so it'll be messy to process the input/output.
Are you sure there's absolutely no other way to authenticate except for using raw tokens?
@isra-fel, thank you for your response. And you are right. Our execution environment is pretty constrained, and we only have access to raw tokens. However, we do have ability to get a token for ARM scope and Attestation scope as well. Is Connect-AzAccount -AccessToken <ARM token> -AttestationAccessToken <attestation token>
a possibility?
And also, let us say that we do Connect-AzAccount -AccessToken <ARM Token>
and then invoke the data plane cmdlets Set-AzAttestationPolicy
. Do the data plane cmdlets not have the ability to request for data plane scope tokens? I reason I say that is because when I do simply Connect-AzAccount
with interactive authentication and without any AuthScope
, the cmdlet Set-AzAttestationPolicy
still ends up requesting for an Attestation token. Why is this behavior not present with if Connect-AzAccount -AccessToken <ARM token>
is used?
Is Connect-AzAccount -AccessToken
-AttestationAccessToken a possibility?
Yes, and that is what we need to work with Attestation team to support. ( @anilba06 )
Do the data plane cmdlets not have the ability to request for data plane scope tokens?
They do, but only if you sign in with actual credentials. When authenticating Az.Accounts will not only retrieve an access token but also a refresh token. The refresh token will be used to redeem another access token for attestation automatically.
However signing in with -AccessToken
skipped authentication therefore these won't be any refresh token to redeem access token for attestation.
I see, thank you @isra-fel
-AccessToken
? Just trying to understand.Connect-AzAccount
, I see that it will only succeed if the -AccessToken
is for ARM. In that sense, can this token be not used to obtain a refresh token? Sorry for the simplification, if it is actually more complex.
Description
Connect-AzAccount
in an environment, where we only have an access token.-Credential
as well.Az.Attestation
, which requires us to use-AuthScope Attestation
withConnect-AzAccount
. Here is how our cmdlet looks likeConnect-AzAccount -AuthScope Attestation -AccessToken <token> -<other common arguments>
.-AccessToken
and-AuthScope
can't be used together in same parameter set.Our questions:
-AccessToken
and-AuthScope
mutually exclusive?-Credential
as well.Issue script & Debug output
Environment data
Module versions
Error output