Azure-Samples / azure-sdk-for-go-samples

Examples of how to utilize Azure services from Go.
MIT License
298 stars 184 forks source link

Can I use resource deployment client to deploy a Azure Mysql with template? #252

Closed azureluo closed 5 years ago

azureluo commented 5 years ago

Hi,

I can use resource deployment client to deploy a VM with template (like azure-sdk-for-go-samples/quickstart/deploy-vm/mai.go). But when I was using it to deploy a Azure mysql with a template (ServicePrinciple authentication as well), it threw out a exception of 'InvalidAuthenticationTokenAudience'.

The detail exception information as below: Failed to deploy Azure MysQL: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=401 -- Original Error: Code="InvalidAuthenticationTokenAudience" Message="The access token has been obtained for wrong audience or resource 'https://vault.azure.net'. It should exactly match with one of the allowed audiences 'https://management.core.windows.net/','https://management.core.windows.net','https://management.azure.com/','https://management.azure.com'."

I have a customer will integrate their IT management system with Azure, this is an obstacle. And they prefer using template to deploy all the resources. Can anybody help me out?

Thanks, Jerry

azureluo commented 5 years ago

Sorry, I used a wrong auth module, it should be "github.com/Azure/go-autorest/autorest/azure/auth".