I'm trying to update a bunch of dns cname entry, using azure-powershell.
I have no troubles getting the dns entry I need to update, but my problem starts when trying to update the cname (due to the fact there can be only one cname entry).
I went to azure documentation, and found about set-azdnsrecordset, but I failed to find the correct parameter/syntax to update the CNAME
Here is what I tried.
$rs = Get-AzDnsRecordSet -name "test1" -RecordType CNAME -ZoneName "zone.io" -ResourceGroupName "dns"
$rs.Records[0].Records = "new-test-v1.com"
Set-AzDnsRecordSet -RecordSet $rs
With error on $rs.Records[0].Records = "new-test-v1.com":
The property 'Records' cannot be found on this object. Verify that the property exists and can be set.
echo $rs
Id : /subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.Network/dnszones/[redacted].io/CNAME/test1
Name : test1
ZoneName : zone.io
ResourceGroupName : dns
Ttl : 3600
Etag : [redacted]
RecordType : CNAME
TargetResourceId :
Records : {test-v1.com}
Metadata :
ProvisioningState : Succeeded
PS : I did found a working solution. Deleting/recreating the records works fine enough. I also realise that if something goes wrong in the creation segment, I lose my record (setting failsafe would be a lot of additional work), So I keep it as a last ressort.

