Skip to content

Commit fa49b02

Browse files
authored
Merge pull request #1 from Azure/master
Sync with latest
2 parents cf84676 + ddaf855 commit fa49b02

File tree

913 files changed

+60504
-15529
lines changed

Some content is hidden

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

913 files changed

+60504
-15529
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# To make sure Network PRs go to the right branch, e.g. network-april
22
/src/Network/ @number213
3+
4+
/src/Compute/ @bilaakpan-ms @sandido @dkulkarni-ms @haagha @madewithsmiles @MS-syh2qs @grizzlytheodore

setup/InstallerChecks.CA.dll

3.72 KB
Binary file not shown.

setup/InstallerChecks/InstallerChecks/InstallerChecks.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<DesignTime>True</DesignTime>
5151
<DependentUpon>Resources.resx</DependentUpon>
5252
</Compile>
53-
<Content Include="InstallerChecks.config" />
53+
<Content Include="CustomAction.config">
54+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
55+
</Content>
5456
</ItemGroup>
5557
<ItemGroup>
5658
<EmbeddedResource Include="Properties\Resources.resx">

src/Accounts/Accounts.Test/AzureRMProfileTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,15 +1081,15 @@ public void CanRenewTokenLogin()
10811081
Assert.Equal(keyVaultToken2, account.GetProperty(AzureAccount.Property.KeyVaultAccessToken));
10821082
var factory = new ClientFactory();
10831083
var rmClient = factory.CreateArmClient<MockServiceClient>(profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
1084-
var rmCred = rmClient.Credentials as TokenCredentials;
1084+
var rmCred = rmClient.Credentials as RenewingTokenCredential;
10851085
Assert.NotNull(rmCred);
10861086
var message = new HttpRequestMessage(HttpMethod.Get, rmClient.BaseUri.ToString());
10871087
rmCred.ProcessHttpRequestAsync(message, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();
10881088
Assert.NotNull(message.Headers.Authorization);
10891089
Assert.NotNull(message.Headers.Authorization.Parameter);
10901090
Assert.Contains(accessToken2, message.Headers.Authorization.Parameter);
10911091
var graphClient = factory.CreateArmClient<MockServiceClient>(profile.DefaultContext, AzureEnvironment.Endpoint.Graph);
1092-
var graphCred = graphClient.Credentials as TokenCredentials;
1092+
var graphCred = graphClient.Credentials as RenewingTokenCredential;
10931093
Assert.NotNull(graphCred);
10941094
var graphMessage = new HttpRequestMessage(HttpMethod.Get, rmClient.BaseUri.ToString());
10951095
graphCred.ProcessHttpRequestAsync(graphMessage, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult();

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IMod
5050
public const int DefaultMaxContextPopulation = 25;
5151
public const string DefaultMaxContextPopulationString = "25";
5252

53-
private IAzureEnvironment _environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud];
53+
private IAzureEnvironment _environment;
5454

5555
[Parameter(Mandatory = false, HelpMessage = "Name of the environment containing the account to log into")]
5656
[Alias("EnvironmentName")]
@@ -188,6 +188,15 @@ protected override IAzureContext DefaultContext
188188
protected override void BeginProcessing()
189189
{
190190
base.BeginProcessing();
191+
if (AzureEnvironment.PublicEnvironments.ContainsKey(EnvironmentName.AzureCloud))
192+
{
193+
_environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud];
194+
}
195+
else
196+
{
197+
WriteWarning($"Default environment {EnvironmentName.AzureCloud} cannot be found from PublicEnvironment list. ");
198+
WriteWarning("You can get current list via [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureEnvironment]::PublicEnvironments");
199+
}
191200
if (MyInvocation.BoundParameters.ContainsKey(nameof(Environment)))
192201
{
193202
var profile = GetDefaultProfile();

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Loaded all public cloud environments when discovery endpoint doesn't return default AzureCloud or other public environments [#12633]
2122
* Exposed SubscriptionPolicies in `Get-AzSubscription` [#12551]
2223

2324
## Version 1.9.2
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Microsoft.Azure.Commands.Common.Authentication.Authentication
6+
{
7+
public class ExternalAccessToken : IAccessToken
8+
{
9+
public string AccessToken
10+
{
11+
get; set;
12+
}
13+
14+
public string LoginType
15+
{
16+
get; set;
17+
}
18+
19+
public string TenantId
20+
{
21+
get; set;
22+
}
23+
24+
public string UserId
25+
{
26+
get; set;
27+
}
28+
29+
private readonly Func<string> _refresh;
30+
31+
public ExternalAccessToken(string token, Func<string> refresh = null)
32+
{
33+
this.AccessToken = token;
34+
this._refresh = refresh;
35+
}
36+
37+
public void AuthorizeRequest(Action<string, string> authTokenSetter)
38+
{
39+
AccessToken = (_refresh == null) ? AccessToken : _refresh();
40+
authTokenSetter("Bearer", AccessToken);
41+
}
42+
}
43+
}

src/Accounts/Authentication/Factories/AuthenticationFactory.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using System.Security;
2222
using Microsoft.Azure.Commands.Common.Authentication.Properties;
2323
using System.Threading.Tasks;
24+
using Microsoft.Azure.Commands.Common.Authentication.Authentication;
25+
using System.Management.Automation;
2426

2527
namespace Microsoft.Azure.Commands.Common.Authentication.Factories
2628
{
@@ -302,7 +304,7 @@ public ServiceClientCredentials GetServiceClientCredentials(IAzureContext contex
302304
case AzureAccount.AccountType.Certificate:
303305
throw new NotSupportedException(AzureAccount.AccountType.Certificate.ToString());
304306
case AzureAccount.AccountType.AccessToken:
305-
return new TokenCredentials(GetEndpointToken(context.Account, targetEndpoint));
307+
return new RenewingTokenCredential(new ExternalAccessToken (GetEndpointToken(context.Account, targetEndpoint), () => GetEndpointToken(context.Account, targetEndpoint)));
306308
}
307309

308310

src/Aks/Aks/Commands/NewKubeBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
2222
using Microsoft.Azure.Management.ContainerService.Models;
2323
using Microsoft.WindowsAzure.Commands.Common;
24+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2425
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2526

2627
namespace Microsoft.Azure.Commands.Aks
2728
{
2829
public abstract class NewKubeBase : CreateOrUpdateKubeBase
2930
{
31+
[CmdletParameterBreakingChange("NodeVmSetType", ChangeDescription = "Default value will be changed from AvailabilitySet to VirtualMachineScaleSets.")]
3032
[Parameter(Mandatory = false, HelpMessage = "Represents types of an node pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'")]
3133
[PSArgumentCompleter("AvailabilitySet", "VirtualMachineScaleSets")]
3234
public string NodeVmSetType { get; set; }
@@ -37,6 +39,7 @@ public abstract class NewKubeBase : CreateOrUpdateKubeBase
3739
[Parameter(Mandatory = false, HelpMessage = "Maximum number of pods that can run on node.")]
3840
public int NodeMaxPodCount { get; set; }
3941

42+
[CmdletParameterBreakingChange("NodeOsType", ChangeDescription = "NodeOsType will be removed as it supports only one value Linux.")]
4043
[Parameter(Mandatory = false, HelpMessage = "OsType to be used to specify os type, currently support 'Linux' only here.")]
4144
[PSArgumentCompleter("Linux")]
4245
public string NodeOsType { get; set; }
@@ -92,6 +95,7 @@ public abstract class NewKubeBase : CreateOrUpdateKubeBase
9295
+ "At least one lower case, one upper case, one special character !@#$%^&*(), the minimum lenth is 12.")]
9396
public SecureString WindowsProfileAdminUserPassword { get; set; }
9497

98+
[CmdletParameterBreakingChange("NetworkPlugin", ChangeDescription = "Default value will be changed from None to azure.")]
9599
[Parameter(Mandatory = false, HelpMessage = "Network plugin used for building Kubernetes network.")]
96100
[PSArgumentCompleter("azure", "kubenet")]
97101
public string NetworkPlugin { get; set; }

src/Automation/Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,20 @@ public void SetAzureAutomationWebhookToDisabledSuccessful()
5050
string name = "webhookName";
5151

5252
this.mockAutomationClient.Setup(
53-
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false));
53+
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false, "TestHybridGroup"));
5454

5555
// Test
5656
this.cmdlet.ResourceGroupName = resourceGroupName;
5757
this.cmdlet.AutomationAccountName = accountName;
5858
this.cmdlet.Name = name;
5959
this.cmdlet.IsEnabled = false;
6060
this.cmdlet.Parameters = null;
61+
this.cmdlet.RunOn = "TestHybridGroup";
6162
this.cmdlet.ExecuteCmdlet();
6263

6364
// Assert
6465
this.mockAutomationClient.Verify(
65-
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false),
66+
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false, "TestHybridGroup"),
6667
Times.Once());
6768
}
6869
}

src/Automation/Automation/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added `-RunOn` parameters to `Set-AzAutomationWebhook` to specify a Hybrid Worker Group
2122

2223
## Version 1.3.7
2324
* Fixed the issue that string with escape chars cannot be converted into json object.

src/Automation/Automation/Cmdlet/SetAzureAutomationWebhook.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public class SetAzureAutomationWebhook : AzureAutomationBaseCmdlet
4949
HelpMessage = "The Runbook parameters name/value.")]
5050
public IDictionary Parameters { get; set; }
5151

52+
/// <summary>
53+
/// Gets or sets the optional hybrid agent friendly name upon which the runbook should be executed.
54+
/// </summary>
55+
[Parameter(Mandatory = false,
56+
HelpMessage = "Optional name of the hybrid agent which should execute the runbook")]
57+
[Alias("HybridWorker")]
58+
public string RunOn { get; set; }
59+
5260
/// <summary>
5361
/// Execute this cmdlet.
5462
/// </summary>
@@ -60,7 +68,8 @@ protected override void AutomationProcessRecord()
6068
this.AutomationAccountName,
6169
this.Name,
6270
this.Parameters,
63-
this.IsEnabled);
71+
this.IsEnabled,
72+
this.RunOn);
6473
this.WriteObject(updatedWebhook);
6574
}
6675
}

src/Automation/Automation/Common/AutomationPSClientWebhook.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ public Model.Webhook UpdateWebhook(
145145
string automationAccountName,
146146
string name,
147147
IDictionary parameters,
148-
bool? isEnabled)
148+
bool? isEnabled,
149+
string RunOn)
149150
{
150151
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
151152
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
@@ -168,6 +169,11 @@ public Model.Webhook UpdateWebhook(
168169
webhookPatchParameters.Parameters =
169170
this.ProcessRunbookParameters(resourceGroupName, automationAccountName, webhookModel.Runbook.Name, parameters);
170171
}
172+
if (RunOn != null)
173+
{
174+
webhookPatchParameters.RunOn = RunOn;
175+
176+
}
171177
}
172178

173179
var webhook =

src/Automation/Automation/Common/IAutomationPSClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Model.Webhook CreateWebhook(
171171

172172
IEnumerable<Model.Webhook> ListWebhooks(string resourceGroupName, string automationAccountName, string runbooName, ref string nextLink);
173173

174-
Model.Webhook UpdateWebhook(string resourceGroupName, string automationAccountName, string name, IDictionary parameters, bool? isEnabled);
174+
Model.Webhook UpdateWebhook(string resourceGroupName, string automationAccountName, string name, IDictionary parameters, bool? isEnabled, string runOn);
175175

176176
void DeleteWebhook(string resourceGroupName, string automationAccountName, string name);
177177

src/Automation/Automation/help/Get-AzAutomationSourceControlSyncJob.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,23 @@ for the source control VSTSNative.
4545
```powershell
4646
PS C:\> Get-AzAutomationSourceControlSyncJob -ResourceGroupName "rg1" `
4747
-AutomationAccountName "devAccount" `
48-
-Name "VSTSNative"
49-
-Id "08d6d266-27b6-463c-beea-bc48a67ace15"
48+
-Name "VSTSNative" `
49+
-JobId "08d6d266-27b6-463c-beea-bc48a67ace15"
5050
5151
Status SyncType Exception
5252
------ -------- ---------
5353
Failed FullSync There were errors while syncing the user runbooks. Please see error streams for more information. (T...
5454
```
5555

56+
### Example 3
57+
58+
Gets Azure Automation source control sync jobs. (autogenerated)
59+
60+
<!-- Aladdin Generated Example -->
61+
```powershell
62+
Get-AzAutomationSourceControlSyncJob -AutomationAccountName 'devAccount' -JobId 00000000-0000-0000-0000-00000000000000000 -ResourceGroupName 'rg1' -SourceControlName 'VSTSNative'
63+
```
64+
5665
## PARAMETERS
5766

5867
### -AutomationAccountName

src/Automation/Automation/help/Import-AzAutomationDscConfiguration.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@ Specify the path of an APS script that contains a single DSC configuration.
2626
## EXAMPLES
2727

2828
### Example 1: Import a DSC configuration into Automation
29-
```
30-
PS C:\>Import-AzAutomationDscConfiguration -AutomationAccountName "Contoso17"-ResourceGroupName "ResourceGroup01" -SourcePath "C:\DSC\client.ps1" -Force
29+
```powershell
30+
PS C:\>Import-AzAutomationDscConfiguration -AutomationAccountName "Contoso17" -ResourceGroupName "ResourceGroup01" -SourcePath "C:\DSC\client.ps1" -Force
3131
```
3232

3333
This command imports the DSC configuration in the file named client.ps1 into the Automation account
3434
named Contoso17. The command specifies the *Force* parameter. If there is an existing DSC
3535
configuration, this command replaces it.
3636

37+
### Example 2
38+
39+
Imports a DSC configuration into Automation. (autogenerated)
40+
41+
<!-- Aladdin Generated Example -->
42+
```powershell
43+
Import-AzAutomationDscConfiguration -AutomationAccountName 'Contoso17' -Published -ResourceGroupName 'ResourceGroup01' -SourcePath 'C:\DSC\client.ps1'
44+
```
45+
3746
## PARAMETERS
3847

3948
### -AutomationAccountName

src/Automation/Automation/help/Import-AzAutomationRunbook.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For wps_2 Workflow runbooks, the script must contain a single wps_2 Workflow def
2929
## EXAMPLES
3030

3131
### Example 1: Import a runbook from a file
32-
```
32+
```powershell
3333
PS C:\> $Tags = @{"tag01"="value01"; "tag02"="value02"}
3434
PS C:\> Import-AzAutomationRunbook -Path .\GraphicalRunbook06.graphrunbook -Tags $Tags -ResourceGroup "ResourceGroup01" -AutomationAccountName "AutomationAccount01" -Type GraphicalPowershell
3535
```
@@ -38,6 +38,15 @@ The first command assigns two key/value pairs to the $Tags variable.
3838
The second command imports a graphical runbook called GraphicalRunbook06 into the Automation account named AutomationAccount01.
3939
The command also assigns the tags stored in $Tags.
4040

41+
### Example 2
42+
43+
Imports an Automation runbook. (autogenerated)
44+
45+
<!-- Aladdin Generated Example -->
46+
```powershell
47+
Import-AzAutomationRunbook -AutomationAccountName 'AutomationAccount01' -Name 'Configuration01' -Path .\GraphicalRunbook06.graphrunbook -Published -ResourceGroupName 'ResourceGroup01' -Type PowerShell
48+
```
49+
4150
## PARAMETERS
4251

4352
### -AutomationAccountName

src/Automation/Automation/help/New-AzAutomationAccount.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,21 @@ of other Automation accounts. Automation resources include runbooks, Desired Sta
2727
## EXAMPLES
2828

2929
### Example 1: Create an automation account
30-
```
30+
```powershell
3131
PS C:\> New-AzAutomationAccount -Name "ContosoAutomationAccount" -Location "East US" -ResourceGroupName "ResourceGroup01"
3232
```
3333

3434
This command creates a new automation account named ContosoAutomationAccount in the East US region.
3535

36+
### Example 2
37+
38+
Creates an Automation account. (autogenerated)
39+
40+
<!-- Aladdin Generated Example -->
41+
```powershell
42+
New-AzAutomationAccount -Location 'East US' -Name 'ContosoAutomationAccount' -ResourceGroupName 'ResourceGroup01' -Tags <IDictionary>
43+
```
44+
3645
## PARAMETERS
3746

3847
### -DefaultProfile

src/Automation/Automation/help/New-AzAutomationRunbook.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,21 @@ Specify a name for the runbook.
2626
## EXAMPLES
2727

2828
### Example 1: Create a runbook
29-
```
29+
```powershell
3030
PS C:\>New-AzAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbook02" -ResourceGroupName "ResourceGroup01"
3131
```
3232

3333
This command creates a runbook named Runbook02 in the Azure Automation account named Contoso17.
3434

35+
### Example 2
36+
37+
Creates an Automation runbook. (autogenerated)
38+
39+
<!-- Aladdin Generated Example -->
40+
```powershell
41+
New-AzAutomationRunbook -AutomationAccountName 'Contoso17' -Name 'Runbook02' -ResourceGroupName 'ResourceGroup01' -Type PowerShell
42+
```
43+
3544
## PARAMETERS
3645

3746
### -AutomationAccountName

src/Automation/Automation/help/Register-AzAutomationScheduledRunbook.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,21 @@ The runbook starts based on the schedule you specify using the *ScheduleName* pa
3333
## EXAMPLES
3434

3535
### Example 1: Associate a runbook with a schedule
36-
```
36+
```powershell
3737
PS C:\>Register-AzAutomationScheduledRunbook -AutomationAccountName "Contoso17" -Name "Runbk01" -ScheduleName "Sched01" -ResourceGroupName "ResourceGroup01"
3838
```
3939

4040
This command associates the runbook named Runbk01 with the schedule named Sched01 in the Azure Automation account named Contoso17.
4141

42+
### Example 2
43+
44+
Associates a runbook to a schedule. (autogenerated)
45+
46+
<!-- Aladdin Generated Example -->
47+
```powershell
48+
Register-AzAutomationScheduledRunbook -AutomationAccountName 'Contoso17' -Parameters <IDictionary> -ResourceGroupName 'ResourceGroup01' -RunbookName 'Runbk01' -ScheduleName 'Sched01'
49+
```
50+
4251
## PARAMETERS
4352

4453
### -AutomationAccountName

0 commit comments

Comments
 (0)