Azure / Azure/azure-powershell

Set-AzureRmTrafficManagerProfile does not work after adding endpoint

Open
#7,233 13 comments 8 reactions 1 assignee Claimed by @MikhailTryakhov View on GitHub
act-quality-productivity-squad customer-reported Network - Traffic Manager Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

### Script/Steps for Reproduction

```powershell
$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:
```powershell
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 '' specified for endpoint '' 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

```powershell
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

```powershell
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 '' specified for endpoint '' 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 '' specified for endpoint '' 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 '' specified for endpoint '' is invalid.
Valid endpoint types are: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
'Microsoft.Network/trafficManagerProfiles/externalEndpoints', 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints'.
at Microsoft.Azure.Management.TrafficManager.ProfilesOperations.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.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.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.