Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DnsConnectionSuffix: fails with no ConnectionSpecificSuffix #427

Open
fullenw1 opened this issue Oct 29, 2019 · 3 comments
Open

DnsConnectionSuffix: fails with no ConnectionSpecificSuffix #427

fullenw1 opened this issue Oct 29, 2019 · 3 comments
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@fullenw1
Copy link

Details of the scenario you tried and the problem that is occurring

I need to ensure that the DNS client does not try to register the interface connection while having no DNS specific suffixes.

Verbose logs showing the problem

When not providing the DnsConnectionSuffix parameter the error occurs when compiling the MOF:

PSDesiredStateConfiguration\Node : At line:2 char:2
+  DnsConnectionSuffix LAN_2055578403 {
+  ~~~~~~~~~~~~~~~~~~~
Resource 'DnsConnectionSuffix' requires that a value of type 'String' be provided for property 'ConnectionSpecificSuffix'.
At C:\Program Files\WindowsPowerShell\DscService\Scripts\New-DscConfiguration.ps1:102 char:5
+     Node $AllNodes.NodeName {
+     ~~~~
    + CategoryInfo          : ParserError: (:) [PSDesiredStateConfiguration\node], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingValueForMandatoryProperty,PSDesiredStateConfiguration\node

When providing an empty DnsConnectionSuffix parameter an error occurs when the MOF is applied on computer:

Could not find mandatory property ConnectionSpecificSuffix. Add this property and try again.
    + CategoryInfo          : ObjectNotFound: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 6

Suggested solution to the issue

The resource should not be dependent on the connection suffix but on the interface alias.
With the command line the registration can be disabled, whether the interface has or has not a connection specific suffix.

Get-NetIPInterface | Set-DnsClient -RegisterThisConnectionsAddress $false

The DSC configuration that is used to reproduce the issue (as detailed as possible)

YAML format for Datum

NetworkingDsc:
  DnsConnectionSuffix:
    - InterfaceAlias: LAN
      RegisterThisConnectionsAddress: False
      UseSuffixWhenRegistering: False

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.1794.amd64fre.rs1_release.171008-1615
OsLanguage           : en-US
OsMuiLanguages       : {en-US}
OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

PSVersion                      5.1.14393.1884
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1884
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

Name : NetworkingDsc
Path : C:\Program Files\WindowsPowerShell\Modules\NetworkingDsc\7.4.0.0\NetworkingDsc.psd1
Description : Module with DSC Resources for Networking area
ModuleType : Manifest
Version : 7.4.0.0
@PlagueHO PlagueHO added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Nov 6, 2019
@PlagueHO
Copy link
Member

PlagueHO commented Nov 6, 2019

Hi @fullenw1 - I see. So what you're wanting to be able to do is make the ConnectionSpecificSuffix parameter optional? This is possible I think. But it is not completely straight forward as this resource uses Ensure. There are various nonsensical resource configurations that can result from this change.

It might make more sense to implement a BREAKING CHANGE on the resource and rewrite it like this:

[ClassVersion("1.0.0"), FriendlyName("DnsConnectionSuffix")]
class MSFT_DnsConnectionSuffix : OMI_BaseResource
{
    [Key, Description("Alias of the network interface for which the DNS server address is set.")] String InterfaceAlias;
    [Write, Description("DNS connection-specific suffix to assign to the network interface.")] String ConnectionSpecificSuffix;
    [Write, Description("Specifies that the IP address for this connection is to be registered.")] Boolean RegisterThisConnectionsAddress;
    [Write, Description("Specifies that this host name and the connection specific suffix for this connection are to be registered.")] Boolean UseSuffixWhenRegistering;
};

This would reduce the nonsensical resource configurations that would be possible, but would obviously be a breaking change (for some users).

I'll leave this open for some discussion.

@peppekerstens
Copy link

@PlagueHO: Agree. Primary key for this resource should be the interface alias. Same as the command being used (Set-DnsClient). Not one of its settable properties (which is currently so).

@Clebam
Copy link

Clebam commented Aug 26, 2021

I completely agree with above statements.

I have been searching for a while until I saw this issue. I was trying to use dsc_dnsconnectionsuffix ressource with puppet (which is just wrapper of the dsc resource).

It does not make sense that it does not follow the usage of "Set-DnsClient".

For those who might be interested, here is how I bypassed the issue until there is some fix (this is puppet code)

    exec {  "Configure DNS registering on ${name} interface":
      command  => "Set-DnsClient -InterfaceAlias ${name} -RegisterThisConnectionsAddress $${registerthisconnectionsaddress}",
      unless   => "if ((Get-DnsClient -InterfaceAlias ${name}).RegisterThisConnectionsAddress -ne $${registerthisconnectionsaddress}) { exit 1 }",
      provider => powershell,
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

4 participants