Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

new-AZVirtualNetwork -Dnsserver parameter does not accept more than a single address #8859

Closed jeff-block closed 5 years ago

jeff-block commented 5 years ago

Description

-Dnsserver parameter will not accept a comma or ; delimited list of dnservers. Will only accept a single ip address

Steps to reproduce

Environment data

Name Value


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


## Module versions

<!-- Please run (Get-Module -Name Az.* -ListAvailable) and paste the output in the below code block -->

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.0      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollectio...
Script     1.0.1      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script     1.0.2      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAn...
Script     1.0.0      Az.ApiManagement                    {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagement...
Script     1.0.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationI...
Script     1.1.2      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Ge...
Script     1.0.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeys, New-AzBa...
Script     1.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzC...
Script     1.1.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnPro...
Script     1.0.1      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCo...
Script     1.5.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Upd...
Script     1.0.0      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-Az...
Script     1.0.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistr...
Script     1.0.2      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-Az...
Script     1.0.0      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential...
Script     1.1.0      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvid...
Script     1.0.0      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoSt...
Script     1.0.0      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDns...
Script     1.1.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEve...
Script     1.0.1      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, ...
Script     1.0.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob,...
Script     1.0.2      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionS...
Script     1.0.2      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCer...
Script     1.2.1      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-Az...
Script     1.0.0      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlComm...
Script     1.0.0      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.0.0      Az.Media                            {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMediaServiceKe...
Script     1.0.1      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...
Script     1.3.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGateway...
Script     1.0.0      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, Get-AzNotif...
Script     1.1.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsig...
Script     1.0.0      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolic...
Script     1.0.0      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-...
Script     1.1.0      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRe...
Script     1.0.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedi...
Script     1.0.0      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-Az...
Script     1.2.0      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New...
Script     1.0.0      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNames...
Script     1.0.1      Az.ServiceFabric                    {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertifi...
Script     1.0.2      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script     1.5.0      Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDat...
Script     1.0.3      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-Az...
Script     1.0.0      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefiniti...
Script     1.0.1      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHe...
Script     1.1.1      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-Az...

Debug output

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/d485d8f3-18b1-44d0-bec8-6787b9ac50eb/resourceGroups/RG-Network/providers/Microsoft.Network/vir
tualNetworks/AZ-WESTUS-API-VNET01?api-version=2018-11-01

Headers:
x-ms-client-request-id        : 1ebf7dff-0c93-48d6-8fdf-5ab345ef7680
accept-language               : en-US

Body:
{
  "properties": {
    "addressSpace": {
      "addressPrefixes": [
        "10.17.16.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.17.0.20;10.17.128.20;10.19.96.20;10.21.96.20"
      ]
    },
    "subnets": [],
    "virtualNetworkPeerings": [],
    "enableDdosProtection": false
  },
  "location": "westus"
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-request-id               : 670447bf-bcf7-4847-8ecf-37a846f41c71
x-ms-correlation-request-id   : 1ed1da27-654b-4a00-84a1-c7a2de6ad9a6
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-routing-request-id       : WESTUS:20190326T215205Z:1ed1da27-654b-4a00-84a1-c7a2de6ad9a6
X-Content-Type-Options        : nosniff
Date                          : Tue, 26 Mar 2019 21:52:04 GMT

Body:
{
  "error": {
    "code": "NetcfgInvalidIPAddress",
    "message": "IP address is not valid '10.17.0.20;10.17.128.20;10.19.96.20;10.21.96.20'.",
    "details": []
  }
}

Confirm

Error output

IP address is not valid '10.17.0.20;10.17.128.20;10.19.96.20;10.21.96.20'. StatusCode: 400 ReasonPhrase: Bad Request OperationID : '670447bf-bcf7-4847-8ecf-37a846f41c71'

markcowl commented 5 years ago

@jeff-block are you providing the parameter as -DnsServer val1, val2 or as -DnsServer "val1, val2"

jeff-block commented 5 years ago

as -DnsServer “val1, val2”

Jeff Block || Private Equity | Healthcare | Manufacturing (Big) Data Driven Technology and Business Leader | IN:fluencer, Presenter +1.312.927.1590 || +1.312.604.7381 || jmblock@outlook.com ||Skype: jmblock@outlook.com || @bigDataDictum ||


From: Mark Cowlishaw notifications@github.com Sent: Tuesday, March 26, 2019 3:08 PM To: Azure/azure-powershell Cc: Jeff; Mention Subject: Re: [Azure/azure-powershell] new-AZVirtualNetwork -Dnsserver parameter does not accept more than a single address (#8859)

@jeff-blockhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjeff-block&data=02%7C01%7C%7C6034e03b3012437c513b08d6b2378d30%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636892348987888886&sdata=qM%2BlEHtH8vWrZqsb%2BOIuNExEhcUeWL2H2khQ5XIxQ1A%3D&reserved=0 are you providing the parameter as -DnsServer val1, val2 or as -DnsServer "val1, val2"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fissues%2F8859%23issuecomment-476871529&data=02%7C01%7C%7C6034e03b3012437c513b08d6b2378d30%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636892348987898891&sdata=jhRUEgen5TGtLB9ZqCUl%2BIqqJnFdlU5ryl4RzVOH2Ck%3D&reserved=0, or mute the threadhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPoruIF1F7uqvWFzQnn-XAcgmMTlRp6pks5vappRgaJpZM4cMhMy&data=02%7C01%7C%7C6034e03b3012437c513b08d6b2378d30%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636892348987908903&sdata=DYKbDUR5h4OX4iZTsLyar6dOGLk9lSlW%2B%2FgpQc7SqVM%3D&reserved=0.

jwefers commented 5 years ago
PS C:\> get-help New-AzVirtualNetwork -Parameter DnsServer

-DnsServer <System.String[]>
    Specifies the DNS server for a subnet.

    Required?                    false
    Position?                    named
    Default value                None
    Accept pipeline input?       True (ByPropertyName)
    Accept wildcard characters?  false

Powershell Arrays are given by comma-separating the values. You passed it a string of a single DNS server containing a comma character.

maddieclayton commented 5 years ago

Closing as resolved - please let us know if you are still seeing an issue after applying the fix above.