Azure / Azure/azure-powershell

[Az.TrafficManager] Can't update an endpoint on locked down systems (like SAWs)

Open
#13,543 2 comments 0 reactions 0 assignees View on GitHub
act-quality-productivity-squad Network - Traffic Manager Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

## Description

Locked down systems (like SAWs) use [ConstrainedLanguage Mode](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.1#constrained-language-constrained-language) to provide a "more secure" environment when working with production environments. Unfortunately, this also limits what PowerShell is able to do quite a bit.

One of the things that it restricts is the ability to set properties on a .NET object. You're just not allowed to do it... that means that [the example to update an endpoint](https://docs.microsoft.com/en-us/azure/traffic-manager/traffic-manager-powershell-arm#example-2-updating-an-endpoint-using-get-aztrafficmanagerendpoint-and-set-aztrafficmanagerendpoint) just don't work on SAWs.

## Steps to reproduce

```powershell
$endpoint = Get-AzTrafficManagerEndpoint -Name myendpoint -ProfileName myprofile -ResourceGroupName MyRG -Type ExternalEndpoints
$endpoint.Priority = 3
```

The result is:
> Cannot set property. Property setting is only supported on core types in this language mode

![image](https://user-images.githubusercontent.com/2644648/99585362-142b8c00-299b-11eb-8ac2-a964b2ae06c1.png)

## Environment data

```
Windows PowerShell 5.1 on a SAW
```

## Module versions

```powershell
Az.TrafficManager 1.0.4
```

Contributor guide

Open the contributing guide

Research direction

Start with the Get-AzTrafficManagerEndpoint and Set-AzTrafficManagerEndpoint entry points and reproduce the property-assignment failure in Windows PowerShell 5.1 ConstrainedLanguage Mode on a SAW. Trace how the endpoint is updated without assigning directly to a .NET object, then verify that the documented update scenario works in the locked-down environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.