Skip to content

[Release 0.9.8] Merge master into dev #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 137 commits into from
Sep 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
b095fb7
Merge branch 'master' of https://github.com/Azure/azure-powershell-pr
robertla Apr 10, 2015
4284699
Merge branch 'master' of https://github.com/Azure/azure-powershell
robertla Apr 10, 2015
e0f24ce
bug:1778355 Desktop Support/Add paging for SP
robertla Apr 13, 2015
1bd4cd8
bug:1778355 Desktop Support/Add paging for SP
robertla Apr 13, 2015
a90b9c7
Merge branch 'ChunkedSP' into CITest bad merge deleting file and merg…
robertla Apr 23, 2015
f4b2cbc
bug:1778355 Desktop Support/Add paging for SP
robertla Apr 23, 2015
b188115
Adding Check-In Test to ARA
robertla Apr 24, 2015
d52ef02
Adding Checkin Tests to Azure RemoteApp
robertla Apr 29, 2015
b4f2ab9
Adding Checkin Tests to Azure RemoteApp
robertla May 5, 2015
cff97c6
Adding Checkin Tests to Azure RemoteApp
robertla May 5, 2015
67c965f
Merge branch 'dev' of https://github.com/robertla/azure-powershell in…
robertla May 6, 2015
251e17d
Adding Checkin Tests to Azure RemoteApp
robertla May 6, 2015
aaf9c36
Adding Checkin Tests to Azure RemoteApp
robertla May 15, 2015
9da648c
Merging from Azure/Dev
robertla May 20, 2015
dd530ef
Backing out Paged User code
robertla May 28, 2015
2b8afa5
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
robertla Jun 1, 2015
371f96e
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
robertla Jun 8, 2015
814ccf9
Merge pull request #21 from Azure/dev
sethusrinivasan Jun 19, 2015
b05f2c3
Merge pull request #22 from Azure/dev
sethusrinivasan Jun 29, 2015
53f328c
Merge pull request #23 from Azure/dev
sethusrinivasan Jul 1, 2015
450fdd7
Merge pull request #24 from Azure/dev
sethusrinivasan Jul 9, 2015
63b788c
Merge pull request #25 from Azure/dev
sethusrinivasan Jul 10, 2015
0045bef
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
robertla Jul 12, 2015
3c1c9fb
Merge pull request #26 from Azure/dev
sethusrinivasan Jul 13, 2015
62bd8d1
Merge pull request #27 from Azure/dev
sethusrinivasan Jul 18, 2015
2c2d061
Merge pull request #28 from Azure/dev
sethusrinivasan Jul 21, 2015
89df986
Merge pull request #29 from Azure/dev
sethusrinivasan Jul 22, 2015
096d418
Merge pull request #30 from Azure/dev
sethusrinivasan Jul 23, 2015
7101f23
Removing AD requirement for VNets
robertla Jul 15, 2015
393b299
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
robertla Aug 4, 2015
8e57dd8
Deprecating VNets
robertla Aug 6, 2015
10abbe7
SQL Server Virtual Machine Azure Key Vault Integration
Aug 8, 2015
41bf97c
Updating code based off of the review
robertla Aug 10, 2015
edbc5c8
Updating code based off of the review
robertla Aug 10, 2015
c80ee5d
Merge branch 'RemoteApp' of https://github.com/robertla/azure-powersh…
robertla Aug 10, 2015
6c18a04
Merge branch 'master' of https://github.com/Azure/azure-powershell
robertla Aug 10, 2015
a108bd8
Merge branch 'RemoteApp' of https://github.com/robertla/azure-powersh…
robertla Aug 10, 2015
a0473e0
Don't use default settings when settings are missing
Aug 11, 2015
22f6c4e
Merge pull request #70 from AzureRT/dev
huangpf Aug 11, 2015
b035794
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Aug 11, 2015
593b24c
Merge pull request #31 from Azure/dev
sethusrinivasan Aug 11, 2015
5b8fecb
Merge pull request #71 from Azure/dev
huangpf Aug 12, 2015
c8658ea
SQL Server IaaS Extension cmdlets update
Aug 14, 2015
18cd426
Merge pull request #72 from Azure/dev
huangpf Aug 14, 2015
34f0d78
Merge pull request #73 from AzureRT/dev
huangpf Aug 14, 2015
167cb31
Merge pull request #32 from Azure/dev
sethusrinivasan Aug 14, 2015
3d0f59b
This is update to local branch
Aug 14, 2015
28b5a2b
Merge branch 'Azure-dev' into dev
Aug 14, 2015
e7ac8cb
Merge branch 'master' of https://github.com/Azure/azure-powershell
robertla Aug 17, 2015
24875b7
Removing Scenario test
robertla Aug 17, 2015
72b8faf
Merge branch 'master' of https://github.com/Azure/azure-powershell
robertla Aug 19, 2015
1a2d326
Merge pull request #74 from Azure/dev
huangpf Aug 20, 2015
2bef23a
Merge pull request #75 from Azure/dev
huangpf Aug 24, 2015
275f5ca
Merge branch 'master' of https://github.com/Azure/azure-powershell
robertla Aug 24, 2015
6906291
Merge pull request #33 from Azure/dev
sethusrinivasan Aug 25, 2015
bc42ba2
Merge pull request #76 from Azure/dev
huangpf Aug 25, 2015
d55f852
Merge pull request #34 from Azure/dev
sethusrinivasan Aug 27, 2015
ea5e7d8
Merge pull request #35 from Azure/dev
sethusrinivasan Aug 28, 2015
0eba755
Merge pull request #77 from Azure/dev
huangpf Aug 28, 2015
54b8681
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
robertla Aug 28, 2015
1364ab7
Merge pull request #36 from Azure/dev
sethusrinivasan Aug 29, 2015
1721dc2
Updateing local branch
Aug 29, 2015
b3b331c
Merge pull request #37 from Azure/dev
sethusrinivasan Aug 29, 2015
795eee7
Code Changes:
sethusrinivasan Aug 29, 2015
719cb5d
Merge pull request #78 from Azure/dev
huangpf Aug 31, 2015
fda7468
Merge pull request #80 from Azure/dev
huangpf Aug 31, 2015
7cf0e17
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
sethusrinivasan Aug 31, 2015
61a7ef8
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
sethusrinivasan Aug 31, 2015
79b2ece
Updates to changelog - Added SQLVM cmdlets for ARM
sethusrinivasan Aug 31, 2015
379c026
Merge pull request #39 from Azure/dev
sethusrinivasan Aug 31, 2015
216c8df
- Attributed StorageUrl,StorageAccessKey, Password so that it is igno…
sethusrinivasan Sep 1, 2015
684966d
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
sethusrinivasan Sep 1, 2015
4e7a206
azurecmdfiles.wxi was incorrectly merged. no new files added in SQLVM…
sethusrinivasan Sep 1, 2015
cfe266e
- removed Status parameter, we always need extension status retrieved…
sethusrinivasan Sep 1, 2015
fb38b57
Merge branch 'master' of https://github.com/robertla/azure-powershell
robertla Sep 1, 2015
16fca57
Merge branch 'master' into RDFE_RemoteApp
robertla Sep 1, 2015
2b4e517
Move RequestInterceptor creation into helper method
Sep 1, 2015
07fe35e
Update Batch account cmdlets to use constants
Sep 1, 2015
25e2006
Make Batch resource strings consistent
Sep 1, 2015
7c843ff
Put long attribute definitions on multiple lines
Sep 1, 2015
f89eadf
Merge pull request #81 from Azure/dev
huangpf Sep 1, 2015
61d4ab9
update network help
deepakswifty Sep 1, 2015
0eba234
Revert the non-terminating error message to a warning message.
hyonholee Sep 2, 2015
6f9d33c
Merge pull request #837 from DeepakRajendranMsft/UpdateNetworkHelp
Sep 3, 2015
bfdb5fe
Merge pull request #841 from hyonholee/hotfix
Sep 3, 2015
44ef696
Merge branch 'dev' into Azure/release-0.9.8
Sep 3, 2015
d8cf943
Warn removal of ExpandPermissions switch parameter
vivsriaus Sep 3, 2015
dcc2c9a
Merge remote-tracking branch 'upstream/release-0.9.8' into batchRefactor
Sep 3, 2015
584273a
Merge pull request #850 from jasper-schneider/batchRefactor
stankovski Sep 3, 2015
e2ebac5
commit to release-0.9.8
sethusrinivasan Sep 3, 2015
7fcccb5
Merge pull request #844 from vivsriaus/WarnPermissionRemove
stankovski Sep 3, 2015
4e7024a
Add more warning messages for upcoming changes in ARM cmdlets
vivsriaus Sep 3, 2015
290a49a
More changes
vivsriaus Sep 3, 2015
c050447
Remove resource log test from Commands.Resources.Test
vivsriaus Sep 4, 2015
3bcb701
Data Collection Confirmation
huangpf Sep 4, 2015
f9f8250
Change file suffix
huangpf Sep 4, 2015
8e8ab7a
Adding file deleted by mistake. Adding the same file from the head br…
Sep 4, 2015
21b99bf
Merge branch 'release-0.9.8' of https://github.com/Azure/azure-powers…
huangpf Sep 4, 2015
7c3438e
CheckIfInteractive
huangpf Sep 4, 2015
4beead1
CheckIfInteractive
huangpf Sep 4, 2015
e696d66
Merge pull request #853 from vivsriaus/MoreWarnings
Sep 4, 2015
ab992a1
Merge pull request #852 from sethusrinivasan/release-0.9.8
Sep 4, 2015
41e4c7e
Fix Tests
huangpf Sep 4, 2015
c10c767
Merge pull request #83 from Azure/release-0.9.8
huangpf Sep 4, 2015
48edc24
Tests
huangpf Sep 4, 2015
af71940
Merge branch 'master' into RDFE_RemoteApp
robertla Sep 1, 2015
8935f84
Merge branch 'RDFE_RemoteApp' of https://github.com/robertla/azure-po…
robertla Sep 4, 2015
50312c1
Merge pull request #847 from OJDUDE/release-0.9.8
Sep 4, 2015
3561532
Merge pull request #856 from huangpf/r098
Sep 4, 2015
7360d6b
Add usage log in metric helper
xindzhan Jul 15, 2015
7b3ac7d
Add AzureQoSEvent
xindzhan Jul 17, 2015
f2fb746
Switch to internal test account and enable IP metrics for now
xindzhan Jul 17, 2015
841eee4
Split usage/err enable flag
xindzhan Jul 22, 2015
a5f1772
Add skip condition to LogQosEvent
xindzhan Jul 22, 2015
bb69777
Fix test fail in ActionConfirm
xindzhan Jul 29, 2015
6fe2350
Add timeout to AI flush
xindzhan Jul 31, 2015
3cbf161
remove debug tests
Sep 3, 2015
91251af
updating refs
Sep 4, 2015
f85fb6b
add warning to ASM cmdlets
Aug 28, 2015
8bc7b7d
Merge pull request #861 from robertla/RDFE_RemoteApp
Sep 4, 2015
703907b
remove app.config
Sep 8, 2015
2ba6cad
Merge pull request #862 from shefaliv/dev
Sep 8, 2015
42360a1
Integrate with opt in/out cmdlets
xindzhan Sep 8, 2015
7a61084
Merge pull request #869 from xindzhan/ai
Sep 9, 2015
d50833f
Add wix file for AI dll
xindzhan Sep 9, 2015
0330b5f
Merge pull request #872 from xindzhan/ai
Sep 9, 2015
2059005
Fix storage test for QosEvent writeError
xindzhan Sep 9, 2015
93162be
Merge pull request #875 from xindzhan/ai
Sep 9, 2015
4fe25e5
Fixing Cmdlet Help
dominiqa Sep 11, 2015
c66a1e5
Fix for non-interactive scenario
Sep 11, 2015
13e78b5
Merge pull request #891 from dominiqa/fix
Sep 11, 2015
a07c992
Merge pull request #892 from ljhljh235/release-0.9.8
Sep 11, 2015
6b43f46
Merge pull request #896 from Azure/release-0.9.8
Sep 11, 2015
2fe1f7f
Merge branch 'master' of github.com:Azure/azure-powershell into dev
Sep 11, 2015
d82db34
Split ScenarioTest.Common into ASM & ARM
Sep 13, 2015
3ffbfd5
Fix ARM ScenarioTests.Common
Sep 13, 2015
d9f5bcc
Merge branch 'dev' of github.com:Azure/azure-powershell into dev
Sep 14, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Changed the output format of Get image cmdlets as a table
* Fixed Set-AzureVMAccessExtension cmdlet
* Azure Compute (Service Management) cmdlets
* Changed the warning message to a non-terminating error message for ResourceNotFound in VM cmdlets
* Exposed ComputeImageConfig in Get-AzurePlatformVMImage cmdlet
* Fixed Publish-AzurePlatformExtension and Set-AzurePlatformExtension cmdlets
* Azure Backup - added the following cmdlets
Expand Down Expand Up @@ -44,6 +43,12 @@
* Get-AzureSqlServerActiveDirectoryAdministrator
* Set-AzureSqlServerActiveDirectoryAdministrator
* Remove-AzureSqlServerActiveDirectoryAdministrator
* SQL Server VM cmdlets (ARM)
* New-AzureVMSqlServerAutoPatchingConfig
* New-AzureVMSqlServerAutoBackupConfig
* Set-AzureVMSqlServerExtension
* Get-AzureVMSqlServerExtension
* Remove-AzureVMSqlServerExtension

## 2015.08.17 version 0.9.7
* Azure Profile cmdlets
Expand Down
156 changes: 156 additions & 0 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

191 changes: 188 additions & 3 deletions src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,6 +21,10 @@
using Microsoft.Azure.Common.Authentication;
using Microsoft.Azure.Common.Authentication.Models;
using Microsoft.WindowsAzure.Commands.Common;
using Newtonsoft.Json;
using System.IO;
using System.Management.Automation.Host;
using System.Threading;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common
{
Expand All @@ -34,6 +38,18 @@ public abstract class AzurePSCmdlet : PSCmdlet, IDisposable
private RecordingTracingInterceptor _httpTracingInterceptor;

private DebugStreamTraceListener _adalListener;
protected static AzurePSDataCollectionProfile _dataCollectionProfile = null;

protected AzurePSQoSEvent QosEvent;

protected virtual bool IsUsageMetricEnabled {
get { return false; }
}

protected virtual bool IsErrorMetricEnabled
{
get { return true; }
}

/// <summary>
/// Gets the PowerShell module name used for user agent header.
Expand All @@ -60,10 +76,123 @@ public AzurePSCmdlet()
}

/// <summary>
/// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile and adds user agent.
/// Initialize the data collection profile
/// </summary>
protected static void InitializeDataCollectionProfile()
{
if (_dataCollectionProfile != null && _dataCollectionProfile.EnableAzureDataCollection.HasValue)
{
return;
}

// Get the value of the environment variable for Azure PS data collection setting.
string value = Environment.GetEnvironmentVariable(AzurePSDataCollectionProfile.EnvironmentVariableName);
if (!string.IsNullOrWhiteSpace(value))
{
if (string.Equals(value, bool.FalseString, StringComparison.OrdinalIgnoreCase))
{
// Disable data collection only if it is explictly set to 'false'.
_dataCollectionProfile = new AzurePSDataCollectionProfile(true);
}
else if (string.Equals(value, bool.TrueString, StringComparison.OrdinalIgnoreCase))
{
// Enable data collection only if it is explictly set to 'true'.
_dataCollectionProfile = new AzurePSDataCollectionProfile(false);
}
}

// If the environment value is null or empty, or not correctly set, try to read the setting from default file location.
if (_dataCollectionProfile == null)
{
string fileFullPath = Path.Combine(AzureSession.ProfileDirectory, AzurePSDataCollectionProfile.DefaultFileName);
if (File.Exists(fileFullPath))
{
string contents = File.ReadAllText(fileFullPath);
_dataCollectionProfile = JsonConvert.DeserializeObject<AzurePSDataCollectionProfile>(contents);
}
}

// If the environment variable or file content is not set, create a new profile object.
if (_dataCollectionProfile == null)
{
_dataCollectionProfile = new AzurePSDataCollectionProfile();
}
}

/// <summary>
/// Get the data collection profile
/// </summary>
protected static AzurePSDataCollectionProfile GetDataCollectionProfile()
{
if (_dataCollectionProfile == null)
{
InitializeDataCollectionProfile();
}

return _dataCollectionProfile;
}

/// <summary>
/// Check whether the data collection is opted in from user
/// </summary>
/// <returns>true if allowed</returns>
public static bool IsDataCollectionAllowed()
{
if (_dataCollectionProfile != null &&
_dataCollectionProfile.EnableAzureDataCollection.HasValue &&
_dataCollectionProfile.EnableAzureDataCollection.Value)
{
return true;
}

return false;
}

/// <summary>
/// Save the current data collection profile Json data into the default file path
/// </summary>
/// <param name="profile"></param>
protected abstract void SaveDataCollectionProfile();

protected bool CheckIfInteractive()
{
bool interactive = true;
if (this.Host == null || this.Host.UI == null || this.Host.UI.RawUI == null)
{
interactive = false;
}
else
{
try
{
var test = this.Host.UI.RawUI.KeyAvailable;
}
catch
{
interactive = false;
}
}

if (!interactive && !_dataCollectionProfile.EnableAzureDataCollection.HasValue)
{
_dataCollectionProfile.EnableAzureDataCollection = false;
}
return interactive;
}

/// <summary>
/// Prompt for the current data collection profile
/// </summary>
/// <param name="profile"></param>
protected abstract void PromptForDataCollectionProfileIfNotExists();

/// <summary>
/// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile
/// </summary>
protected override void BeginProcessing()
{
PromptForDataCollectionProfileIfNotExists();
InitializeQosEvent();
if (string.IsNullOrEmpty(ParameterSetName))
{
WriteDebugWithTimestamp(string.Format("{0} begin processing without ParameterSet.", this.GetType().Name));
Expand Down Expand Up @@ -95,6 +224,7 @@ protected override void BeginProcessing()
/// </summary>
protected override void EndProcessing()
{
LogQosEvent();
string message = string.Format("{0} end processing.", this.GetType().Name);
WriteDebugWithTimestamp(message);

Expand Down Expand Up @@ -125,6 +255,13 @@ protected bool IsVerbose()
protected new void WriteError(ErrorRecord errorRecord)
{
FlushDebugMessages();
if (QosEvent != null && errorRecord != null)
{
QosEvent.Exception = errorRecord.Exception;
QosEvent.IsSuccess = false;
LogQosEvent(true);
}

base.WriteError(errorRecord);
}

Expand Down Expand Up @@ -234,6 +371,45 @@ private void FlushDebugMessages()
}
}

protected abstract void InitializeQosEvent();

/// <summary>
/// Invoke this method when the cmdlet is completed or terminated.
/// </summary>
protected void LogQosEvent(bool waitForMetricSending = false)
{
if (QosEvent == null)
{
return;
}

QosEvent.FinishQosEvent();

if (!IsUsageMetricEnabled && (!IsErrorMetricEnabled || QosEvent.IsSuccess))
{
return;
}

if (!IsDataCollectionAllowed())
{
return;
}

WriteDebug(QosEvent.ToString());

try
{
MetricHelper.LogQoSEvent(QosEvent, IsUsageMetricEnabled, IsErrorMetricEnabled);
MetricHelper.FlushMetric(waitForMetricSending);
WriteDebug("Finish sending metric.");
}
catch (Exception e)
{
//Swallow error from Application Insights event collection.
WriteWarning(e.ToString());
}
}

/// <summary>
/// Asks for confirmation before executing the action.
/// </summary>
Expand All @@ -244,10 +420,19 @@ private void FlushDebugMessages()
/// <param name="action">The action code</param>
protected void ConfirmAction(bool force, string actionMessage, string processMessage, string target, Action action)
{
if (QosEvent != null)
{
QosEvent.PauseQoSTimer();
}

if (force || ShouldContinue(actionMessage, ""))
{
if (ShouldProcess(target, processMessage))
{
{
if (QosEvent != null)
{
QosEvent.ResumeQosTimer();
}
action();
}
}
Expand Down
39 changes: 39 additions & 0 deletions src/Common/Commands.Common/AzurePSDataCollectionProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.IO;
using Newtonsoft.Json;
using Microsoft.Azure.Common.Authentication;

namespace Microsoft.WindowsAzure.Commands.Common
{
public class AzurePSDataCollectionProfile
{
public const string EnvironmentVariableName = "Azure_PS_Data_Collection";
public static string DefaultFileName = "AzureDataCollectionProfile.json";

public AzurePSDataCollectionProfile()
{
}

public AzurePSDataCollectionProfile(bool enable)
{
EnableAzureDataCollection = enable;
}

[JsonProperty(PropertyName = "enableAzureDataCollection")]
public bool? EnableAzureDataCollection { get; set; }
}
}
Loading