Skip to content
Merged

. #165

Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Common.Storage;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Microsoft.WindowsAzure.Management.Storage;
using Microsoft.Azure.Commands.Management.Storage;
using Microsoft.Azure.Management.Storage;
using Newtonsoft.Json;

namespace Microsoft.Azure.Commands.Compute
Expand All @@ -37,7 +38,7 @@ public class SetAzureVMDiagnosticsExtensionCommand : VirtualMachineExtensionBase
private const string VirtualMachineExtension = "Microsoft.Compute/virtualMachines/extensions";
private const string IaaSDiagnosticsExtension = "IaaSDiagnostics";
private const string ExtensionPublisher = "Microsoft.Azure.Diagnostics";
private StorageManagementClient storageClient;
private IStorageManagementClient storageClient;

[Parameter(
Mandatory = true,
Expand Down Expand Up @@ -154,14 +155,14 @@ public string PrivateConfiguration
}
}

public StorageManagementClient StorageClient
public IStorageManagementClient StorageClient
{
get
{
if (this.storageClient == null)
{
this.storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>(
DefaultProfile.Context, AzureEnvironment.Endpoint.ServiceManagement);
DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager);
}

return this.storageClient;
Expand Down Expand Up @@ -201,15 +202,8 @@ protected string GetStorageKey()

if (!string.IsNullOrEmpty(StorageAccountName))
{
var storageAccount = this.StorageClient.StorageAccounts.Get(StorageAccountName);
if (storageAccount != null)
{
var keys = this.StorageClient.StorageAccounts.GetKeys(StorageAccountName);
if (keys != null)
{
storageKey = !string.IsNullOrEmpty(keys.PrimaryKey) ? keys.PrimaryKey : keys.SecondaryKey;
}
}
var storageCredentials = StorageUtilities.GenerateStorageCredentials(this.StorageClient, this.ResourceGroupName, this.StorageAccountName);
storageKey = storageCredentials.ExportBase64EncodedKey();
}

return storageKey;
Expand Down
4 changes: 2 additions & 2 deletions tools/Docs/Get-AllCommands/Get-AllCommands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,9 @@ function Get-AllBuildServerCommands {
rm .\Output -Recurse -Force -ErrorAction SilentlyContinue

#Comment these lines to selectivly build the output for either Service Management or Resource Manager
Get-AllBuildServerCommands -OutputPath ".\Output" -ManifestFullName "..\..\..\src\Package\Debug\ServiceManagement\Azure\Azure.psd1"
Get-AllBuildServerCommands -OutputPath ".\Output" -ManifestFullName "..\..\..\src\Package\Release\ServiceManagement\Azure\Azure.psd1"
Get-AllBuildServerCommands -OutputPath ".\Output" -ManifestFullName "..\..\AzureRM\AzureRM.psd1"

$modules = (Get-ChildItem "..\..\..\src\Package\Debug\ResourceManager" -Recurse -Include "*.psd1" -Exclude "*dll-help.psd1", "AzureResourceManager.psd1") | sort -Unique -Property Name
$modules = (Get-ChildItem "..\..\..\src\Package\Release\ResourceManager" -Recurse -Include "*.psd1" -Exclude "*dll-help.psd1", "AzureResourceManager.psd1") | sort -Unique -Property Name
$modules | Foreach { Get-AllBuildServerCommands -OutputPath ".\Output" -ManifestFullName $_.FullName }