Skip to content

Commit c7bdc35

Browse files
committed
Merge branch 'master' of https://github.com/azure/azure-powershell into nonComplianceMessages
2 parents b549209 + a59ff91 commit c7bdc35

File tree

1,694 files changed

+218266
-31747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,694 files changed

+218266
-31747
lines changed

.azure-pipelines/powershell-core.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
windows:
2020
OSName: ${{ variables.WindowsName }}
2121
ImageName: ${{ variables.WindowsImage }}
22-
# linux:
23-
# OSName: ${{ variables.LinuxName }}
24-
# ImageName: ${{ variables.LinuxImage }}
22+
linux:
23+
OSName: ${{ variables.LinuxName }}
24+
ImageName: ${{ variables.LinuxImage }}
2525
macOS:
2626
OSName: ${{ variables.MacOSName }}
2727
ImageName: ${{ variables.MacOSImage }}
@@ -45,9 +45,9 @@ jobs:
4545
windows:
4646
OSName: ${{ variables.WindowsName }}
4747
ImageName: ${{ variables.WindowsImage }}
48-
# linux:
49-
# OSName: ${{ variables.LinuxName }}
50-
# ImageName: ${{ variables.LinuxImage }}
48+
linux:
49+
OSName: ${{ variables.LinuxName }}
50+
ImageName: ${{ variables.LinuxImage }}
5151
macOS:
5252
OSName: ${{ variables.MacOSName }}
5353
ImageName: ${{ variables.MacOSImage }}
@@ -70,9 +70,9 @@ jobs:
7070
windows:
7171
OSName: ${{ variables.WindowsName }}
7272
ImageName: ${{ variables.WindowsImage }}
73-
# linux:
74-
# OSName: ${{ variables.LinuxName }}
75-
# ImageName: ${{ variables.LinuxImage }}
73+
linux:
74+
OSName: ${{ variables.LinuxName }}
75+
ImageName: ${{ variables.LinuxImage }}
7676
macOS:
7777
OSName: ${{ variables.MacOSName }}
7878
ImageName: ${{ variables.MacOSImage }}

.azure-pipelines/util/analyze-steps.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ steps:
77
parameters:
88
osName: ${{ parameters.osName }}
99

10+
- task: UseDotNet@2
11+
displayName: 'Use .NET Core sdk'
12+
inputs:
13+
packageType: sdk
14+
version: 2.1.x
15+
1016
- pwsh: 'Install-Module platyPS -Force -Confirm:$false -Scope CurrentUser'
1117
displayName: 'Install platyPS'
1218

.azure-pipelines/util/build-steps.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ steps:
99
inputs:
1010
filePath: tools/CheckIgnoredFile.ps1
1111

12+
- task: UseDotNet@2
13+
displayName: 'Use .NET Core sdk'
14+
inputs:
15+
packageType: sdk
16+
version: 2.1.x
17+
1218
- task: DotNetCoreCLI@2
1319
displayName: Build
1420
inputs:

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
using Microsoft.Azure.PowerShell.Authenticators.Factories;
3636
using Microsoft.Identity.Client;
3737
using Microsoft.WindowsAzure.Commands.Common;
38+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
3839
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3940

4041
namespace Microsoft.Azure.Commands.Profile
@@ -200,6 +201,9 @@ public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IMod
200201
[Parameter(Mandatory = false, HelpMessage = "Overwrite the existing context with the same name, if any.")]
201202
public SwitchParameter Force { get; set; }
202203

204+
[Parameter(ParameterSetName = ServicePrincipalCertificateParameterSet, Mandatory = false, HelpMessage = "Specifies if the x5c claim (public key of the certificate) should be sent to the STS to achieve easy certificate rollover in Azure AD.")]
205+
public SwitchParameter SendCertificateChain { get; set; }
206+
203207
protected override IAzureContext DefaultContext
204208
{
205209
get
@@ -341,6 +345,24 @@ public override void ExecuteCmdlet()
341345
azureAccount.SetThumbprint(CertificateThumbprint);
342346
}
343347

348+
if (ParameterSetName == ServicePrincipalCertificateParameterSet && SendCertificateChain)
349+
{
350+
azureAccount.SetProperty(AzureAccount.Property.SendCertificateChain, SendCertificateChain.ToString());
351+
bool supressWarningOrError = false;
352+
try
353+
{
354+
supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(BreakingChangeAttributeHelper.SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME));
355+
}
356+
catch
357+
{
358+
//if value of env variable is invalid, use default value of supressWarningOrError
359+
}
360+
if (!supressWarningOrError)
361+
{
362+
WriteWarning(Resources.PreviewFunctionMessage);
363+
}
364+
}
365+
344366
if (!string.IsNullOrEmpty(Tenant))
345367
{
346368
azureAccount.SetProperty(AzureAccount.Property.Tenants, Tenant);

src/Accounts/Accounts/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
-->
2020

2121
## Upcoming Release
22-
* Upgraded Azure.Identity to 1.4 and MSAL lib to 4.30.1
22+
* Upgraded Azure.Identity to 1.4 and MSAL to 4.30.1
2323
* Removed obsolete parameters `ManagedServiceHostName`, `ManagedServicePort` and `ManagedServiceSecret` of cmdlet `Connect-AzAccount`, environment variables `MSI_ENDPOINT` and `MSI_SECRET` could be used instead
2424
* Customize display format of PSAzureRmAccount to hide secret of service principal [#14208]
2525
* Added optional parameter `AuthScope` to `Connect-AzAccount` to support enhanced authentication of data plane features
2626
* Set retry times by environment variable [#14748]
27+
* Supported subject name issuer authentication
2728

2829
## Version 2.2.8
2930
* Fallback to first valid context if current default context key is "Default" which is invalid

src/Accounts/Accounts/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Accounts/Accounts/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,7 @@
528528
<data name="InteractiveAuthNotSupported" xml:space="preserve">
529529
<value>Interactive authentication is not supported in this session, please run cmdlet 'Connect-AzAccount -UseDeviceAuthentication'.</value>
530530
</data>
531+
<data name="PreviewFunctionMessage" xml:space="preserve">
532+
<value>This function is in preview. It may not be available in the selected subscription.</value>
533+
</data>
531534
</root>

src/Accounts/Accounts/help/Connect-AzAccount.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ Connect-AzAccount [-Environment <String>] -Credential <PSCredential> [-Tenant <S
4040
```
4141
Connect-AzAccount [-Environment <String>] -CertificateThumbprint <String> -ApplicationId <String>
4242
[-ServicePrincipal] -Tenant <String> [-Subscription <String>] [-AuthScope <String>] [-ContextName <String>]
43-
[-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>]
44-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
43+
[-SkipContextPopulation] [-MaxContextPopulation <Int32>] [-Force] [-SendCertificateChain]
44+
[-Scope <ContextModificationScope>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
45+
[<CommonParameters>]
4546
```
4647

4748
### AccessTokenWithSubscriptionId
@@ -56,7 +57,6 @@ Connect-AzAccount [-Environment <String>] [-Tenant <String>] -AccessToken <Strin
5657
### ManagedServiceLogin
5758
```
5859
Connect-AzAccount [-Environment <String>] [-Tenant <String>] [-AccountId <String>] [-Identity]
59-
[-ManagedServicePort <Int32>] [-ManagedServiceHostName <String>] [-ManagedServiceSecret <SecureString>]
6060
[-Subscription <String>] [-AuthScope <String>] [-ContextName <String>] [-SkipContextPopulation]
6161
[-MaxContextPopulation <Int32>] [-Force] [-Scope <ContextModificationScope>]
6262
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
@@ -209,11 +209,13 @@ Once AuthScope is specified, e.g. Storage, Connect-AzAccount will first login wi
209209
```powershell
210210
Connect-AzAccount -AuthScope Storage
211211
```
212+
212213
```Output
213214
Account SubscriptionName TenantId Environment
214215
------- ---------------- -------- -----------
215216
yyyy-yyyy-yyyy-yyyy Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud
216217
```
218+
217219
## PARAMETERS
218220

219221
### -AccessToken
@@ -479,6 +481,21 @@ Accept pipeline input: False
479481
Accept wildcard characters: False
480482
```
481483

484+
### -SendCertificateChain
485+
Specifies if the x5c claim (public key of the certificate) should be sent to the STS to achieve easy certificate rollover in Azure AD.
486+
487+
```yaml
488+
Type: System.Management.Automation.SwitchParameter
489+
Parameter Sets: ServicePrincipalCertificateWithSubscriptionId
490+
Aliases:
491+
492+
Required: False
493+
Position: Named
494+
Default value: None
495+
Accept pipeline input: False
496+
Accept wildcard characters: False
497+
```
498+
482499
### -ServicePrincipal
483500

484501
Indicates that this account authenticates by providing service principal credentials.

src/Accounts/Authentication/Authentication/Parameters/AuthenticationParameters.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public AuthenticationParameters(
3333
IAzureEnvironment environment,
3434
IAzureTokenCache tokenCache,
3535
string tenantId,
36-
string resourceId)
36+
string resourceId,
37+
bool? sendCertificateChain = null)
3738
{
3839
TokenCacheProvider = tokenCacheProvider;
3940
Environment = environment;

src/Accounts/Authentication/Authentication/Parameters/ServicePrincipalParameters.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public class ServicePrincipalParameters : AuthenticationParameters
2626

2727
public SecureString Secret { get; set; }
2828

29+
public bool? SendCertificateChain { get; set; } = null;
30+
2931
public ServicePrincipalParameters(
3032
PowerShellTokenCacheProvider tokenCacheProvider,
3133
IAzureEnvironment environment,
@@ -34,11 +36,13 @@ public ServicePrincipalParameters(
3436
string resourceId,
3537
string applicationId,
3638
string thumbprint,
37-
SecureString secret) : base(tokenCacheProvider, environment, tokenCache, tenantId, resourceId)
39+
SecureString secret,
40+
bool? sendCertificateChain) : base(tokenCacheProvider, environment, tokenCache, tenantId, resourceId)
3841
{
3942
ApplicationId = applicationId;
4043
Thumbprint = thumbprint;
4144
Secret = secret;
45+
SendCertificateChain = sendCertificateChain;
4246
}
4347
}
4448
}

src/Accounts/Authentication/Factories/AuthenticationFactory.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,14 @@ private AuthenticationParameters GetAuthenticationParameters(
551551
return new UsernamePasswordParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, password, null);
552552
case AzureAccount.AccountType.Certificate:
553553
case AzureAccount.AccountType.ServicePrincipal:
554+
bool? sendCertificateChain = null;
555+
var sendCertificateChainStr = account.GetProperty(AzureAccount.Property.SendCertificateChain);
556+
if (!string.IsNullOrWhiteSpace(sendCertificateChainStr))
557+
{
558+
sendCertificateChain = Boolean.Parse(sendCertificateChainStr);
559+
}
554560
password = password ?? ConvertToSecureString(account.GetProperty(AzureAccount.Property.ServicePrincipalSecret));
555-
return new ServicePrincipalParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, account.GetProperty(AzureAccount.Property.CertificateThumbprint), password);
561+
return new ServicePrincipalParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, account.GetProperty(AzureAccount.Property.CertificateThumbprint), password, sendCertificateChain);
556562
case AzureAccount.AccountType.ManagedService:
557563
return new ManagedServiceIdentityParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account);
558564
case AzureAccount.AccountType.AccessToken:

src/Accounts/Authenticators/ServicePrincipalAuthenticator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public override Task<IAccessToken> Authenticate(AuthenticationParameters paramet
4949

5050
var options = new ClientCertificateCredentialOptions()
5151
{
52-
AuthorityHost = new Uri(authority)
52+
AuthorityHost = new Uri(authority),
53+
SendCertificateChain = spParameters.SendCertificateChain ?? default(bool)
5354
};
5455

5556
if (!string.IsNullOrEmpty(spParameters.Thumbprint))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PsModuleName>Compute</PsModuleName>
5+
</PropertyGroup>
6+
7+
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />
8+
9+
<PropertyGroup>
10+
<TargetFramework>netstandard2.0</TargetFramework>
11+
<AssemblyName>Microsoft.Azure.PowerShell.Cmdlets.Compute.Helpers</AssemblyName>
12+
<RootNamespace>Microsoft.Azure.PowerShell.Cmdlets.Compute.Helpers</RootNamespace>
13+
<NoWarn>CS0108</NoWarn>
14+
</PropertyGroup>
15+
16+
</Project>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// <auto-generated>
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License. See License.txt in the project root for
4+
// license information.
5+
//
6+
// Code generated by Microsoft (R) AutoRest Code Generator.
7+
// Changes may cause incorrect behavior and will be lost if the code is
8+
// regenerated.
9+
// </auto-generated>
10+
11+
namespace Microsoft.Azure.PowerShell.Cmdlets.Compute.Helpers.Network
12+
{
13+
using Microsoft.Rest;
14+
using Microsoft.Rest.Azure;
15+
using Models;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Threading;
19+
using System.Threading.Tasks;
20+
21+
/// <summary>
22+
/// LoadBalancersOperations operations.
23+
/// </summary>
24+
public partial interface ILoadBalancersOperations
25+
{
26+
/// <summary>
27+
/// Gets the specified load balancer.
28+
/// </summary>
29+
/// <param name='resourceGroupName'>
30+
/// The name of the resource group.
31+
/// </param>
32+
/// <param name='loadBalancerName'>
33+
/// The name of the load balancer.
34+
/// </param>
35+
/// <param name='expand'>
36+
/// Expands referenced resources.
37+
/// </param>
38+
/// <param name='customHeaders'>
39+
/// The headers that will be added to request.
40+
/// </param>
41+
/// <param name='cancellationToken'>
42+
/// The cancellation token.
43+
/// </param>
44+
/// <exception cref="Microsoft.Rest.Azure.CloudException">
45+
/// Thrown when the operation returned an invalid status code
46+
/// </exception>
47+
/// <exception cref="Microsoft.Rest.SerializationException">
48+
/// Thrown when unable to deserialize the response
49+
/// </exception>
50+
/// <exception cref="Microsoft.Rest.ValidationException">
51+
/// Thrown when a required parameter is null
52+
/// </exception>
53+
Task<AzureOperationResponse<LoadBalancer>> GetWithHttpMessagesAsync(string resourceGroupName, string loadBalancerName, string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
54+
/// <summary>
55+
/// Creates or updates a load balancer.
56+
/// </summary>
57+
/// <param name='resourceGroupName'>
58+
/// The name of the resource group.
59+
/// </param>
60+
/// <param name='loadBalancerName'>
61+
/// The name of the load balancer.
62+
/// </param>
63+
/// <param name='parameters'>
64+
/// Parameters supplied to the create or update load balancer
65+
/// operation.
66+
/// </param>
67+
/// <param name='customHeaders'>
68+
/// The headers that will be added to request.
69+
/// </param>
70+
/// <param name='cancellationToken'>
71+
/// The cancellation token.
72+
/// </param>
73+
/// <exception cref="Microsoft.Rest.Azure.CloudException">
74+
/// Thrown when the operation returned an invalid status code
75+
/// </exception>
76+
/// <exception cref="Microsoft.Rest.SerializationException">
77+
/// Thrown when unable to deserialize the response
78+
/// </exception>
79+
/// <exception cref="Microsoft.Rest.ValidationException">
80+
/// Thrown when a required parameter is null
81+
/// </exception>
82+
Task<AzureOperationResponse<LoadBalancer>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string loadBalancerName, LoadBalancer parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
83+
/// <summary>
84+
/// Creates or updates a load balancer.
85+
/// </summary>
86+
/// <param name='resourceGroupName'>
87+
/// The name of the resource group.
88+
/// </param>
89+
/// <param name='loadBalancerName'>
90+
/// The name of the load balancer.
91+
/// </param>
92+
/// <param name='parameters'>
93+
/// Parameters supplied to the create or update load balancer
94+
/// operation.
95+
/// </param>
96+
/// <param name='customHeaders'>
97+
/// The headers that will be added to request.
98+
/// </param>
99+
/// <param name='cancellationToken'>
100+
/// The cancellation token.
101+
/// </param>
102+
/// <exception cref="Microsoft.Rest.Azure.CloudException">
103+
/// Thrown when the operation returned an invalid status code
104+
/// </exception>
105+
/// <exception cref="Microsoft.Rest.SerializationException">
106+
/// Thrown when unable to deserialize the response
107+
/// </exception>
108+
/// <exception cref="Microsoft.Rest.ValidationException">
109+
/// Thrown when a required parameter is null
110+
/// </exception>
111+
Task<AzureOperationResponse<LoadBalancer>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string loadBalancerName, LoadBalancer parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
112+
}
113+
}

0 commit comments

Comments
 (0)