I have some code written in Go using the Azure SDK for Go. I'm trying to get a DNS TXT record from a known zone. I have the following in Go:
import (
"github.com/Azure/go-autorest/autorest/azure/auth"
"github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns"
"log"
)
cli := dns.NewRecordSetsClient("subscription-id-goes-here")
authorizer, err := auth.NewAuthorizerFromEnvironment()
// Error checking and stuff the authorizer into cli
// ....
valu, err := cli.Get(context.Background(), "resource-group", "zone", "", dns.RecordType("TXT"))
if err != nil {
log.Fatalf("Error: %s", err.Error())
}
The output of that error looks something like this:
dns.RecordSetsClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: error response cannot be parsed: "\ufeff<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n <head>\r\n <title>Service</title>\r\n <style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } " error: invalid character 'ï' looking for beginning of value
What am I doing wrong with my request, and why am I getting what is obviously HTML back?