I'm new to Azure and struggling to generate the Go code that's equivalent to az ad app credential list --id=${ID}
.
I find the Azure Go SDK to be comprehensive but the documentation is lacking. Is there a general-purpose mechanism by which I can determine the Go SDK from an az
command?
Update So, it appears the services
package (containing services/graphrbac
) is deprecated and that azidentity
is the preferred auth package. And I can continue to use azidentity.NewDefaultAzureCredential
But, I'm still unable to determine the Go package that matches az ad app credential list
.
I asked ChatGPT and it gave me something (non-working) that uses the Graph RBAC API with which I'm entirely unfamiliar
I have known-working code that uses azidentity.NewDefaultAzureCredential(nil)
to authenticate using both the CLI's credentials and a certificate and, would like to stick with this familiar (powerful) mechanism if possible.
It's unclear to me whether secretClient.ListKeyCredentials
is even the correct package/method that I need to use.
Any guidance would be appreciated.
Which of the two tags is correct? azure-sdk-for-go
or azure-sdk-go
?
You can try calling the ListPasswordCredentials function from the graphrbac go package to fetch the passwordCredentials associated with an application. Please update the below sample code:
Hope this helps.