Skip to content

Set-AzureRmTrafficManagerProfile does not work after adding endpoint #7233

Open
@FirePho

Description

@FirePho

Description

Script/Steps for Reproduction

$tmProfile = New-AzureRmTrafficManagerProfile -Name "tmForTest" -ResourceGroupName "rgForTest" -ProfileStatus Enabled -TrafficRoutingMethod Performance -RelativeDnsName "tmForTest" -TTL 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/default.aspx"

Add-AzureRmTrafficManagerEndpointConfig -EndpointName "contoso" -EndpointStatus Enabled -Target "www.contoso.com" -TrafficManagerProfile $tmProfile -Type ExternalEndpoints -EndpointLocation "North Europe" -Priority 1 

Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $tmProfile

Error:

Set-AzureRmTrafficManagerProfile : Endpoint name '' is invalid. Endpoint names cannot be empty or all whitespace, and m
ust be up to 260 alphanumeric characters long. The type '<null>' specified for endpoint '<null>' is invalid. Valid endp
oint types are: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints', 'Microsoft.Network/trafficManagerProfiles/ex
ternalEndpoints', 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints'.
At line:1 char:1
+ Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureRmTrafficManagerProfile], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.TrafficManager.SetAzureTrafficManagerProfile

Module Version

PS C:\WINDOWS\system32> Get-Module -Name AzureRM -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.8.1      AzureRM

Environment Data

PS C:\WINDOWS\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.551
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.551
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Debug Output

DEBUG: 14:32:09 - SetAzureTrafficManagerProfile begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 14:32:09 - using account id '[sensitive]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[sensitive]', environment: '[sensitive]', tenant: '[sensitive]'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - AcquireTokenHandlerBase: === Token Acquisition started:
 Authority: https://login.microsoftonline.com/[sensitive]/
 Resource: https://management.core.windows.net/
 ClientId: [sensitive]
 CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (2 items)
 Authentication Target: Client

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 09/13/2018 11:32:09:  - TokenCache: Deserialized 2 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - TokenCache: An item matching the requested resource was
found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - TokenCache: 34.4708682583333 minutes left until token in
cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - TokenCache: A matching item (access token or refresh token
or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 09/13/2018 11:32:09: [sensitive] - AcquireTokenHandlerBase: === Token Acquisition finished
successfully. An access token was retuned:
 Access Token Hash: [sensitive]
 Refresh Token Hash: [No Refresh Token]
 Expiration Time: 09/13/2018 12:06:38 +00:00
 User Hash: null

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

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/[sensitive]/resourceGroups/rgForTest/providers/Microsoft.Network/trafficmanagerprofiles/tmForTest?api-version=2018-04-01

Headers:
x-ms-client-request-id        : [sensitive]
accept-language               : en-US

Body:
{
  "properties": {
    "profileStatus": "Enabled",
    "trafficRoutingMethod": "Performance",
    "dnsConfig": {
      "relativeName": "tmfortest",
      "ttl": 30
    },
    "monitorConfig": {
      "protocol": "HTTP",
      "port": 80,
      "path": "/default.aspx",
      "intervalInSeconds": 30,
      "timeoutInSeconds": 10,
      "toleratedNumberOfFailures": 3
    },
    "endpoints": [
      {
        "properties": {
          "target": "www.contoso.com",
          "endpointStatus": "Enabled",
          "priority": 1,
          "endpointLocation": "North Europe"
        }
      }
    ]
  },
  "location": "global"
}

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

Status Code:
BadRequest

Headers:
X-Content-Type-Options        : nosniff
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : [sensitive]
x-ms-ratelimit-remaining-subscription-resource-requests: 10799
x-ms-correlation-request-id   : [sensitive]
x-ms-routing-request-id       : WESTEUROPE:20180913T113211Z:[sensitive]
Cache-Control                 : private
Date                          : Thu, 13 Sep 2018 11:32:10 GMT
Server                        : Microsoft-IIS/8.5
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "code": "BadRequest",
  "message": "Endpoint name '' is invalid. Endpoint names cannot be empty or all whitespace, and must be up to 260
alphanumeric characters long. The type '<null>' specified for endpoint '<null>' is invalid. Valid endpoint types are:
'Microsoft.Network/trafficManagerProfiles/azureEndpoints', 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
'Microsoft.Network/trafficManagerProfiles/nestedEndpoints'."
}

Set-AzureRmTrafficManagerProfile : Endpoint name '' is invalid. Endpoint names cannot be empty or all whitespace, and must be
up to 260 alphanumeric characters long. The type '<null>' specified for endpoint '<null>' is invalid. Valid endpoint types are
: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints', 'Microsoft.Network/trafficManagerProfiles/externalEndpoints', 'Mi
crosoft.Network/trafficManagerProfiles/nestedEndpoints'.
At line:1 char:1
+ Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $tmProfile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureRmTrafficManagerProfile], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.TrafficManager.SetAzureTrafficManagerProfile

DEBUG: AzureQoSEvent: CommandName - Set-AzureRmTrafficManagerProfile; IsSuccess - False; Duration - 00:00:01.3185135;
Exception - Microsoft.Rest.Azure.CloudException: Endpoint name '' is invalid. Endpoint names cannot be empty or all
whitespace, and must be up to 260 alphanumeric characters long. The type '<null>' specified for endpoint '<null>' is invalid.
Valid endpoint types are: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
'Microsoft.Network/trafficManagerProfiles/externalEndpoints', 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints'.
   at Microsoft.Azure.Management.TrafficManager.ProfilesOperations.<CreateOrUpdateWithHttpMessagesAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.TrafficManager.ProfilesOperationsExtensions.<CreateOrUpdateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.TrafficManager.ProfilesOperationsExtensions.CreateOrUpdate(IProfilesOperations operations,
String resourceGroupName, String profileName, Profile parameters)
   at Microsoft.Azure.Commands.TrafficManager.Utilities.TrafficManagerClient.SetTrafficManagerProfile(TrafficManagerProfile
profile)
   at Microsoft.Azure.Commands.TrafficManager.SetAzureTrafficManagerProfile.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 14:32:12 - SetAzureTrafficManagerProfile end processing.
DEBUG: 14:32:12 - SetAzureTrafficManagerProfile end processing.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions