1

我正在尝试在此处遵循本教程的 Web 应用程序的自定义域中创建 DNS 记录。

我来到创建 A 记录的步骤。现在我在 azure powershell 中运行以下命令

New-AzDnsRecordSet -Name "@" -RecordType "A" -ZoneName "herewego.com" -ResourceGroupName "my-dns-zone-resource-group" -Ttl 600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address "21.162.38.259")

我收到以下错误消息

bash: syntax error near unexpected token `('

我错过了什么?

向 Azure DNS 添加记录

更新

我使用了详细标志,但它是一样的


vivekanand@Azure:~$ New-AzDnsRecordSet -Name "@" -RecordType "A" -ZoneName "herewego.com" -ResourceGroupName "my-dns-zone-resource-group" -Ttl 600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address "21.162.38.259") --verbose

bash: syntax error near unexpected token `('


vivekanand@Azure:~$ New-AzDnsRecordSet --verbose -Name "@" -RecordType "A" -ZoneName "herewego.com" -ResourceGroupName "my-dns-zone-resource-group" -Ttl 600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address "21.162.38.259")

bash: syntax error near unexpected token `('


This time, I use double quotes around (New-AzDnsRecordConfig -IPv4Address "21.162.38.259") as follow. I get a different error 

vivekanand@Azure:~$ New-AzDnsRecordSet -Name "@" -RecordType "A" -ZoneName "herewego.com" -ResourceGroupName "my-dns-zone-resource-group" -Ttl 600 -DnsRecords "(New-AzDnsRecordConfig -IPv4Address "21.162.38.259")"

bash: New-AzDnsRecordSet: command not found
4

1 回答 1

0

正如@Gaurav Mantri 建议的那样,您尝试使用的命令是一个Az-Powershell绝对不能在BASH.

在此处输入图像描述

要使用创建 DNS 记录,BASH您可以尝试使用az cli cmd

az network dns record-set a add-record -g MyResourceGroup -z xxxtest.com -n www -a xx.xx.xx.8

输出- ![在此处输入图像描述 在此处输入图像描述

仍然,如果您希望使用Az-powershell cmd select powershell from cloud shell 。并且可以尝试使用MS DOC中提到的命令

New-AzDnsRecordSet -Name "@" -RecordType "txt" -ZoneName "xxxxxx.com" `
 -ResourceGroupName "RG NAME" -Ttl 600 `
 -DnsRecords (New-AzDnsRecordConfig -IPv4Address "xx.xx.xx.8")

输出: 在此处输入图像描述

于 2022-01-17T08:15:25.660 回答