Set-AzureDnsRecordSet

Set-AzureDnsRecordSet

Updates a DNS record set.

Syntax

Parameter Set: Object
Set-AzureDnsRecordSet -RecordSet <DnsRecordSet> [-Overwrite] [-Profile <Microsoft.Azure.Common.Authentication.Models.AzureProfile> ] [ <CommonParameters>]

Detailed Description

The Set-AzureDnsRecordSet cmdlet updates a RecordSet from an offline RecordSet object. If the Etag has changed since the last get, the call will fail unless the Overwrite switch is specified.

You can pass a RecordSet as a parameter or by using the pipeline operator.

Parameters

-Overwrite

Indicates that this cmdlet ignores the Etag when deleting the record set, and that the record set is deleted even if it has changed since the last Get.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Profile<Microsoft.Azure.Common.Authentication.Models.AzureProfile>

Specifies an Azure profile.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RecordSet<DnsRecordSet>

Specifies the RecordSet to update.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Azure.Commands.Dns.DnsRecordSet

    You can pass a RecordSet object to this cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Azure.Commands.Dns.DnsRecordSet

    This cmdlet returns an object that represents the updated RecordSet.

Examples

Example 1: Update a record set

The first command uses the Get-AzureDnsRecordset cmdlet to get the specified record set, and then stores it in the $RecordSet variable.

The second command uses the pipeline operator to pass $RecordSet to the Add-AzureDnsRecordConfig cmdlet to add an IP address as an A record, and then stores it in $RecordSet.

The third command uses the pipeline operator to pass $RecordSet to the Add-AzureDnsRecordConfig cmdlet to add another IP address as an A record, and then stores it in $RecordSet.

The final command uses the pipeline operator to pass $RecordSet to the Set-AzureDnsRecordSet cmdlet to propagate the update.

PS C:\> $RecordSet = Get-AzureDnsRecordSet -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" -Name "www" -RecordType A
PS C:\> $RecordSet = $RecordSet | Add-AzureDnsRecordConfig -Ipv4Address "172.16.0.0"
PS C:\> $RecordSet = $RecordSet | Add-AzureDnsRecordConfig -Ipv4Address "172.31.255.255"
PS C:\> $RecordSet | Set-AzureDnsRecordSet

Example 2: Update an SOA record

The first command uses the Get-AzureDnsRecordset cmdlet to get the specified record set, and then stores it in the $RecordSet variable.

The second command updates the specified SOA record in $RecordSet.

The final command uses the Set-AzureDnsRecordSet cmdlet to propagate the update in $RecordSet.

PS C:\> $RecordSet = Get-AzureDnsRecordSet -Name "@" -RecordType SOA -Zone $Zone
PS C:\> $RecordSet.Records[0].Email = "bob@test.com"
PS C:\> Set-AzureDnsRecordSet -RecordSet $RecordSet 

Get-AzureDnsRecordSet

New-AzureDnsRecordSet

Remove-AzureDnsRecordSet