Azure仮想マシンのパブリックIPアドレスに独自の逆引きFQDNを設定する
Azureの仮想マシンなどに固定のIPアドレスを割り当て(予約)していて、独自の逆引きFQDNを設定したくなったので調べてみました。 ASMの場合はクラウドサービスに対して設定、ARMの場合はパブリックIPアドレスリソースの属性を設定、となるようです。
固定IPアドレスじゃなかったり、正引きが登録されていなかったりするとエラーになるかと思います。
サービスマネージャー(ASM)の場合はこちら。
# 逆引きを設定する Set-AzureService -ServiceName [(クラウドサービスの)サービス名] -ReverseDnsFqdn '[設定したいFQDN]' # 逆引きを削除する Set-AzureService -ServiceName [(クラウドサービスの)サービス名] -ReverseDnsFqdn ''
リソースマネージャー(ARM)の場合はこんな感じです。
# 逆引きを設定する $pip = Get-AzureRmPublicIpAddress -Name [パブリックIPアドレス名] -ResourceGroupName [リソースグループ名] $pip.DnsSettings.ReverseFqdn = '[設定したいFQDN].' Set-AzureRmPublicIpAddress -PublicIpAddress $pip # 逆引きを削除する $pip = Get-AzureRmPublicIpAddress -Name [パブリックIPアドレス名] -ResourceGroupName [リソースグループ名] $pip.DnsSettings.ReverseFqdn = '' Set-AzureRmPublicIpAddress -PublicIpAddress $pip
ARMの場合、Azure Resource Explorer から publicIpAddresses リソースを直接書き換えても構わないとは思いますが未検証です。
何か問題があると以下のようなエラーが出ますので、いろいろと見直してみて下さい。
ReverseFqdn [FQDN名] that PublicIPAddress [IPアドレス名] is trying to use does not belong to subscription [サブスクリプションID].
One of the following conditions need to be met to establish ownership:1) ReverseFqdn matches fqdn of any public ip resource under the subscription;
2) ReverseFqdn resolves to the fqdn (through CName records chain) of any public ip resource under the subcription;
3) It resolves to the ip address (through CName and A records chain) of a static public ip resource under the subscription.