Skip to content

Commit f2403c9

Browse files
committed
Merge branch 'master' of https://github.com/ranishan/azure-powershell into AgListnerCmdlet
2 parents 5272f5f + b517ce4 commit f2403c9

File tree

650 files changed

+861287
-441551
lines changed

Some content is hidden

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

650 files changed

+861287
-441551
lines changed

ChangeLog.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
1+
## 3.3.0 - January 2020
2+
#### Az.Accounts
3+
* Updated Add-AzEnvironment and Set-AzEnvironment to accept parameters AzureAttestationServiceEndpointResourceId and AzureAttestationServiceEndpointSuffix
4+
5+
#### Az.Cdn
6+
* Display error response detail in New-AzCdnEndpoint cmdlet
7+
8+
#### Az.Compute
9+
* Fix Set-AzVMCustomScriptExtension cmdlet for a VM with managed OD disk which does not have OS profile.
10+
11+
#### Az.ContainerInstance
12+
* Fixed parameter names used by example of New-AzContainerGroup
13+
14+
#### Az.DataBoxEdge
15+
* Added cmdlet 'Get-AzDataBoxEdgeStorageContainer'
16+
- Get the Edge Storage Container
17+
* Added cmdlet 'New-AzDataBoxEdgeStorageContainer'
18+
- Create new Edge Storage Container
19+
* Added cmdlet 'Remove-AzDataBoxEdgeStorageContainer'
20+
- Remove the Edge Storage Container
21+
* Added cmdlet 'Invoke-AzDataBoxEdgeStorageContainer'
22+
- Invoke action to refresh data on Edge Storage Container
23+
* Added cmdlet 'Get-AzDataBoxEdgeStorageAccount'
24+
- Get the Edge Storage Account
25+
* Added cmdlet 'New-AzDataBoxEdgeStorageAccount'
26+
- Create new Edge Storage Account
27+
* Added cmdlet 'Remove-AzDataBoxEdgeStorageAccount'
28+
- Remove the Edge Storage Account
29+
* Invoke cmdlet 'Invoke-AzDataBoxEdgeShare'
30+
- Invoke action to refresh data on share
31+
* Added cmdlet 'Set-AzDataBoxEdgeStorageAccountCredential'
32+
- Set the az databoxedge storage account credential
33+
34+
#### Az.DataFactory
35+
* Add AutoUpdateETA, LatestVersion, PushedVersion, TaskQueueId and VersionStatus properties for Get-AzDataFactoryV2IntegrationRuntime cmd
36+
* Update ADF .Net SDK version to 4.6.0
37+
* Add parameter 'PublicIPs' for 'Set-AzureRmDataFactoryV2IntegrationRuntime' cmd
38+
to enable create Azure-SSIS IR with static public IP addresses.
39+
40+
#### Az.DevTestLabs
41+
* Remove the broken link in Get-AzDtlAllowedVMSizesPolicy.md
42+
43+
#### Az.EventHub
44+
* Fix for issue 10634 : Fix the null Object reference for remove eventhubnamespace
45+
46+
#### Az.HDInsight
47+
* Fix Invoke-AzHDInsightHiveJob.md error.
48+
49+
#### Az.MachineLearning
50+
* Removed below cmdlets because MachineLearningCompute is not available any longer
51+
- Get-AzMlOpCluster
52+
- Get-AzMlOpClusterKey
53+
- New-AzMlOpCluster
54+
- Remove-AzMlOpCluster
55+
- Set-AzMlOpCluster
56+
- Test-AzMlOpClusterSystemServicesUpdateAvailability
57+
- Update-AzMlOpClusterSystemService
58+
59+
#### Az.Network
60+
* Upgrade dependency of Microsoft.Azure.Management.Sql from 1.36-preview to 1.37-preview
61+
62+
#### Az.RecoveryServices
63+
* Azure Site Recovery change support for managed disk vms encrypted at rest with customer managed leys for Azure to Azure provider.
64+
* Azure Site Recovery support to input disk encryption Set Id as optional input at enabling protection for Vmware to Azure.
65+
* Azure Site Recovery support to input disk encryption Set Id as optional input at disk level to enable protection for Vmware to Azure.
66+
* Azure Site Recovery support to update replication protected item with disk encryption set Map for HyperV to Azure.
67+
68+
#### Az.Resources
69+
* Fix an error in help document of 'Remove-AzTag'.
70+
71+
#### Az.Sql
72+
* Fix vulnerability assessment set baseline cmdlets functionality to work on master db for azure database and limit it on managed instance system databases.
73+
* Fix an error when creating SQL instance failover group
74+
75+
#### Az.SqlVirtualMachine
76+
* Add DR as a new valid License type
77+
78+
#### Az.Storage
79+
* Add breaking change warning message for DefaultAction Value change in a future release
80+
- Update-AzStorageAccountNetworkRuleSet
81+
* Support Get last sync time of Storage account by run get-AzureRMStorageAccount with parameter -IncludeGeoReplicationStats
82+
- Get-AzureRMStorageAccount
83+
184
## 3.2.0 - December 2019
285

386
### General

documentation/development-docs/azure-powershell-developer-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Before submitting a design review, please be sure that you have read the documen
143143

144144
Please submit a design review here: https://github.com/Azure/azure-powershell-cmdlet-review-pr
145145

146-
_Note_: You will need to be part of the `GitHub Azure` org to see this repository. Please go to [this link](aka.ms/azuregithub) to become part of the `Azure` org.
146+
_Note_: You will need to be part of the `GitHub Azure` org to see this repository. Please go to [this link](https://aka.ms/azuregithub) to become part of the `Azure` org.
147147

148148
We recommend using the `platyPS` module to easily generate markdown files that contains the above information and including the files in the design submission.
149149

documentation/development-docs/design-guidelines/parameter-best-practices.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66

77
The following are naming conventions to keep in mind when coming up with a name for your parameters.
88

9-
In addition, a recommended list of parameter names can be found [here](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/standard-cmdlet-parameter-names-and-types).
9+
In addition, a recommended list of parameter names can be found [here](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/standard-cmdlet-parameter-names-and-types).
1010

1111
#### Standard Parameter Name
1212

13-
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#use-standard-parameter-names):
13+
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#use-standard-parameter-names):
1414

1515
> _Your cmdlet should use standard parameter names so that the user can quickly determine what a particular parameter means. If a more specific name is required, use a standard parameter name, and then specify a more specific name as an alias. For example, the `Get-Service` cmdlet has a parameter that has a generic name (**Name**) and a more specific alias (**ServiceName**). Both terms can be used to specify the parameter._
1616
1717
#### Pascal Case
1818

19-
Similar to cmdlets, parameters should follow pascal casing.From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#use-pascal-case-for-parameter-names):
19+
Similar to cmdlets, parameters should follow pascal casing.From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#use-pascal-case-for-parameter-names):
2020

2121
> _Use Pascal case for parameter names. In other words, capitalize the first letter of each word in the parameter name, including the first letter of the name._
2222
2323
#### Singularity
2424

25-
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#use-singular-parameter-names):
25+
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#use-singular-parameter-names):
2626

2727
> _Avoid using plural names for parameters whose value is a single element. This includes parameters that take arrays or lists because the user might supply an array or list with only one element._
2828
>
@@ -40,15 +40,15 @@ The type of parameters should always be defined; a parameter should never be of
4040

4141
#### Consistent Parameter Types
4242

43-
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#use-consistent-parameter-types):
43+
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#use-consistent-parameter-types):
4444

4545
> _When the same parameter is used by multiple cmdlets, always use the same parameter type. For example, if the **Process** parameter is an **Int16** type for one cmdlet, do not make the **Process** parameter for another cmdlet a **UInt16** type._
4646
4747
#### Array vs. Enumerable Types
4848

4949
For parameters that require a collection of elements to be provided, use an array instead of any other enumerable type to represent this collection.
5050

51-
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#support-arrays-for-parameters):
51+
From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#support-arrays-for-parameters):
5252

5353
> _Frequently, users must perform the same operation against multiple arguments. For these users, a cmdlet should accept an array as parameter input so that a user can pass the arguments into the parameter as a Windows PowerShell variable. For example, the `Get-Process` cmdlet uses an array for the strings that identify the names of the processes to retrieve._
5454
@@ -126,7 +126,7 @@ The following are naming conventions to keep in mind when coming up with a name
126126

127127
#### Pascal Case
128128

129-
Similar to parameters (mentioned above), parameter set names should follow pascal casing. From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/strongly-encouraged-development-guidelines#use-pascal-case-for-cmdlet-names-sd02):
129+
Similar to parameters (mentioned above), parameter set names should follow pascal casing. From the [_Strongly Encouraged Development Guidelines_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines#use-pascal-case-for-cmdlet-names-sd02):
130130

131131
> _Use Pascal case for cmdlet names. In other words, capitalize the first letter of the verb and all terms used in the noun. For example, "Clear-ItemProperty"._
132132
@@ -136,22 +136,22 @@ The following are guidelines that should be followed when working with the attri
136136

137137
#### Mutually Exclusive Parameter Sets
138138

139-
For PowerShell to determine which parameter set a user is intending to use with a set of provided parameters, the parameter sets need to be designed in such a way that they are mutually exclusive. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/parameter-attribute-declaration#remarks):
139+
For PowerShell to determine which parameter set a user is intending to use with a set of provided parameters, the parameter sets need to be designed in such a way that they are mutually exclusive. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/parameter-attribute-declaration#remarks):
140140

141141
> _Each parameter set must have at least one unique parameter. Good cmdlet design indicates this unique parameter should also be mandatory if possible. If your cmdlet is designed to be run without parameters, the unique parameter cannot be mandatory._
142142
143143
#### Positional Parameters Limit
144144

145-
It is possible to call a PowerShell cmdlet without providing the parameter names, but just the values you would like to pass through. This is done by specifying the position at which the value of each parameter should be provided by using the `Position` property for a parameter. However, when there are too many positional parameters in a single parameter set, it can be difficult for the user to remember the exact ordering in which the parameter values should be provided. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/parameter-attribute-declaration#remarks):
145+
It is possible to call a PowerShell cmdlet without providing the parameter names, but just the values you would like to pass through. This is done by specifying the position at which the value of each parameter should be provided by using the `Position` property for a parameter. However, when there are too many positional parameters in a single parameter set, it can be difficult for the user to remember the exact ordering in which the parameter values should be provided. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/parameter-attribute-declaration#remarks):
146146

147147
> _When you specify positional parameters, limit the number of positional parameters in a parameter set to less than five. And, positional parameters do not have to be contiguous. Positions 5, 100, and 250 work the same as positions 0, 1, and 2._
148148
149-
In addition, there should be no two parameters with the same position in the same parameter set. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/parameter-attribute-declaration#remarks):
149+
In addition, there should be no two parameters with the same position in the same parameter set. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/parameter-attribute-declaration#remarks):
150150

151151
> _No parameter set should contain more than one positional parameter with the same position._
152152
153153
#### ValueFromPipeline Limit
154154

155-
Allowing the user to pipe an object from one cmdlet to another is a major scenario in PowerShell, but allowing multiple parameters in the same parameter set to accept their value from the pipeline can cause issues. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/developer/cmdlet/parameter-attribute-declaration#remarks):
155+
Allowing the user to pipe an object from one cmdlet to another is a major scenario in PowerShell, but allowing multiple parameters in the same parameter set to accept their value from the pipeline can cause issues. From the remarks section of [_Parameter Attribute Declaration_](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/parameter-attribute-declaration#remarks):
156156

157-
> _Only one parameter in a parameter set should declare ValueFromPipeline = true. Multiple parameters can define ValueFromPipelineByPropertyName = true._
157+
> _Only one parameter in a parameter set should declare ValueFromPipeline = true. Multiple parameters can define ValueFromPipelineByPropertyName = true._
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ---------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Common.Authentication;
16+
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
17+
using Microsoft.Azure.Commands.Common.Authentication.Core;
18+
using Microsoft.Azure.Commands.Common.Authentication.Models;
19+
using Microsoft.Azure.Commands.Common.Authentication.Properties;
20+
using Microsoft.Azure.Commands.ResourceManager.Common;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
using Newtonsoft.Json;
24+
using System;
25+
using System.IO;
26+
using Xunit;
27+
using Xunit.Abstractions;
28+
29+
namespace Microsoft.Azure.Commands.Profile.Test
30+
{
31+
public class AutoSaveSettingOnLoadingTests
32+
{
33+
private MemoryDataStore dataStore;
34+
private string profileBasePath;
35+
private string settingsPath;
36+
37+
public AutoSaveSettingOnLoadingTests(ITestOutputHelper output)
38+
{
39+
dataStore = new MemoryDataStore();
40+
profileBasePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
41+
settingsPath = Path.Combine(profileBasePath, Resources.AzureDirectoryName);
42+
settingsPath = Path.Combine(settingsPath, ContextAutosaveSettings.AutoSaveSettingsFile);
43+
}
44+
45+
internal string HookSettingFile(string hook)
46+
{
47+
var result = new ContextAutosaveSettings
48+
{
49+
CacheDirectory = hook,
50+
ContextDirectory = hook,
51+
Mode = ContextSaveMode.CurrentUser,
52+
CacheFile = "TokenCache.dat",
53+
ContextFile = "AzureRmContext.json"
54+
};
55+
56+
var backupPath = String.Empty;
57+
if (!dataStore.FileExists(settingsPath))
58+
{
59+
string directoryPath = Path.GetDirectoryName(settingsPath);
60+
if (!dataStore.DirectoryExists(directoryPath))
61+
{
62+
dataStore.CreateDirectory(directoryPath);
63+
}
64+
}
65+
else
66+
{
67+
backupPath = BackupSetting();
68+
}
69+
dataStore.WriteFile(settingsPath, JsonConvert.SerializeObject(result));
70+
return backupPath;
71+
}
72+
73+
internal string BackupSetting()
74+
{
75+
var backupPath = settingsPath + ".bak";
76+
dataStore.CopyFile(settingsPath, backupPath);
77+
return backupPath;
78+
}
79+
80+
internal void RestoreSetting(string backupPath)
81+
{
82+
if(dataStore.FileExists(backupPath))
83+
{
84+
dataStore.DeleteFile(settingsPath);
85+
dataStore.CopyFile(backupPath, settingsPath);
86+
dataStore.DeleteFile(backupPath);
87+
}
88+
else
89+
{
90+
dataStore.DeleteFile(settingsPath);
91+
}
92+
}
93+
94+
[Fact]
95+
[Trait(Category.AcceptanceType, Category.CheckIn)]
96+
public void DisableAutoSaveWhenSettingFileBreaks()
97+
{
98+
string faker = Path.Combine(Directory.GetParent(profileBasePath).ToString(), "faker");
99+
faker = Path.Combine(faker,Resources.AzureDirectoryName);
100+
var backupPath = HookSettingFile(faker);
101+
102+
try
103+
{
104+
AzureSessionInitializer.CreateOrReplaceSession(dataStore);
105+
TestMockSupport.RunningMocked = true;
106+
var cmdlet = new ConnectAzureRmAccountCommand();
107+
cmdlet.OnImport();
108+
Assert.Equal(ContextSaveMode.Process, AzureSession.Instance.ARMContextSaveMode);
109+
Assert.Equal(typeof(ResourceManagerProfileProvider), AzureRmProfileProvider.Instance.GetType());
110+
var afterModified = dataStore.ReadFileAsText(settingsPath);
111+
var newSetting = JsonConvert.DeserializeObject<ContextAutosaveSettings>(afterModified) as ContextAutosaveSettings;
112+
Assert.NotNull(newSetting);
113+
Assert.Equal(ContextSaveMode.CurrentUser, newSetting.Mode);
114+
Assert.Equal(typeof(AuthenticationStoreTokenCache), AzureSession.Instance.TokenCache.GetType());
115+
}
116+
finally
117+
{
118+
RestoreSetting(backupPath);
119+
}
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)