Skip to content

HPF PR: dev <- huangpf:dev #206

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 22 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
55da97f
RDTask 5996083:[PSH]Add support for add and create permission when ge…
blueww Apr 1, 2016
2960d78
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
blueww Apr 7, 2016
f69dcd8
Change log for RDTask 5996083:[PSH]Add support for add and create per…
blueww Apr 8, 2016
f1cb95d
RDTask 5996083:[PSH]Add support for add and create permission when ge…
blueww Apr 13, 2016
7d78473
Merge branch 'dev' of https://github.com/wastoresh/azure-powershell i…
blueww Apr 18, 2016
0febede
RDTask 5913133:[PSH]Support E@R feature in new SRP SDK
blueww Apr 18, 2016
e16b662
Merge Conflict of Changelog.md
blueww Apr 20, 2016
ba4c668
Adding script cmdlets for managing storage accounts. This will repla…
markcowl Apr 20, 2016
de5e01a
Merge branch 'dev' of github.com:wastoresh/azure-powershell into stor…
markcowl Apr 20, 2016
83c8de2
Removed extra restore cmdlet. Removed Commands.Management.Storage ref…
Apr 20, 2016
ed43136
filling the properties of the output of import/export operations usin…
llali Apr 20, 2016
f888e20
Update script storage new-azurermstorageaccount implementation to rem…
markcowl Apr 20, 2016
5081dac
Update script storage new-azurermstorageaccount implementation to rem…
markcowl Apr 20, 2016
fc1e525
Merge branch 'storageversions' of github.com:markcowl/azure-powershel…
markcowl Apr 20, 2016
6ad0a4c
Adding new storage test cmdlets to Sql tests
markcowl Apr 20, 2016
53aa8a7
Merge pull request #1 from markcowl/storageversions
blueww Apr 20, 2016
c9af07f
validating the properties in the result of import/export operation co…
llali Apr 20, 2016
6a98682
Update Change log for E@R, Cool and sas permission add
blueww Apr 21, 2016
874c8c2
Merge pull request #2122 from Nking92/dev
Apr 21, 2016
c84b700
Merge pull request #2127 from llali/dev2
Apr 21, 2016
c841ea3
Merge pull request #2119 from wastoresh/dev
markcowl Apr 21, 2016
887e17d
Merge pull request #512 from Azure/dev
huangpf Apr 22, 2016
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
17 changes: 17 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
##2016.05.03 version 1.4.0
* Azure Storage
* Upgrade to Microsoft.Azure.Management.Storage nuget package v5.0 preview
* Add Encryption and Hot/Cool features support to resource mode storage account cmdlets
- New-AzureRmStorageAccount
- Set-AzureRmStorageAccount
* Add "Add" and "Create" permission to Blob SAS cmdlets
- New-AzureStorageBlobSASToken
- New-AzureStorageContainerSASToken
- New-AzureStorageContainerStoredAccessPolicy
- Set-AzureStorageContainerStoredAccessPolicy
* Add "Create" permission to File SAS cmdlets
- New-AzureStorageFileSASToken
- New-AzureStorageShareSASToken
- New-AzureStorageShareStoredAccessPolicy
- Set-AzureStorageShareStoredAccessPolicy

##2016.04.19 version 1.3.2
* Add support for specifying NIC/VMSS as application gateway backend address
* Fix HDI ADL cluster creation and live test
Expand Down
4 changes: 4 additions & 0 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,9 @@
<Component Id="cmpA2A4B67ACC8738C88A82A9576BD82026" Guid="*">
<File Id="fil2E6EA8F5997FA6DBE29FCE3A58F051DF" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll" />
</Component>
<Component Id="cmp3AE4D7EAA86E455A89006A85332F6B3A" Guid="*">
<File Id="fil6C5492894C2F4DDD80E710891D53B6D2" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.Azure.dll" />
</Component>
<Component Id="cmpE56C0006C325EFBAD7984DBBCF689FD2" Guid="*">
<File Id="filDAF92272D69F4A127139311912333F8B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.dll" />
</Component>
Expand Down Expand Up @@ -5798,6 +5801,7 @@
<ComponentRef Id="cmp4EA5A818E3BE7C67C27B69ADABCE5CBF" />
<ComponentRef Id="cmpBF600E80A7D04977AF21CAA07A79254C" />
<ComponentRef Id="cmpA2A4B67ACC8738C88A82A9576BD82026" />
<ComponentRef Id="cmp3AE4D7EAA86E455A89006A85332F6B3A" />
<ComponentRef Id="cmpE56C0006C325EFBAD7984DBBCF689FD2" />
<ComponentRef Id="cmpA94FD747C692B4A9A45D9DE5D869DE53" />
<ComponentRef Id="cmp7F0D9683DB4D431F6A1A42EBCAD0E4E3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
<Link>ScenarioTests\AzureRM.Storage.ps1</Link>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ private void RunPowerShellTest(params string[] scripts)
_helper.RMProfileModule,
_helper.RMResourceModule,
_helper.RMStorageDataPlaneModule,
_helper.RMStorageModule,
_helper.GetRMModulePath("AzureRM.ApiManagement.psd1"));
_helper.GetRMModulePath("AzureRM.ApiManagement.psd1"),
"AzureRM.Storage.ps1");

_helper.RunPowerShellTest(scripts);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

function Get-AzureRmStorageAccount
{

[CmdletBinding()]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
BEGIN {
$context = Get-Context
$client = Get-StorageClient $context
}
PROCESS {
$getTask = $client.StorageAccounts.GetPropertiesAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
$sa = $getTask.Result
$account = Get-StorageAccount $ResourceGroupName $Name
Write-Output $account
}
END {}

}

function New-AzureRmStorageAccount
{
[CmdletBinding()]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)][alias("StorageAccountName")] $Name,
[string] [Parameter(Position=2, ValueFromPipelineByPropertyName=$true)] $Location,
[string] [Parameter(Position=3, ValueFromPipelineByPropertyName=$true)] $Type)
BEGIN {
$context = Get-Context
$client = Get-StorageClient $context
}
PROCESS {
$createParms = New-Object -Type Microsoft.Azure.Management.Storage.Models.StorageAccountCreateParameters
$createParms.AccountType = [Microsoft.Azure.Management.Storage.Models.AccountType]::StandardLRS
$createParms.Location = $Location
$getTask = $client.StorageAccounts.CreateAsync($ResourceGroupName, $name, $createParms, [System.Threading.CancellationToken]::None)
$sa = $getTask.Result
}
END {}

}

function Get-AzureRmStorageAccountKey
{
[CmdletBinding()]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
BEGIN {
$context = Get-Context
$client = Get-StorageClient $context
}
PROCESS {
$getTask = $client.StorageAccounts.ListKeysAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
Write-Output $getTask.Result.StorageAccountKeys
}
END {}
}

function Remove-AzureRmStorageAccount
{

[CmdletBinding()]
param(
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
BEGIN {
$context = Get-Context
$client = Get-StorageClient $context
}
PROCESS {
$getTask = $client.StorageAccounts.DeleteAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
$sa = $getTask.Result
}
END {}

}

function Get-Context
{
[Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext]$context = $null
$profile = [Microsoft.WindowsAzure.Commands.Common.AzureRmProfileProvider]::Instance.Profile
if ($profile -ne $null)
{
$context = $profile.Context
}

return $context
}

function Get-StorageClient
{
param([Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext] $context)
$factory = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::ClientFactory
[System.Type[]]$types = [Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext], [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]
$method = [Microsoft.Azure.Commands.Common.Authentication.IClientFactory].GetMethod("CreateClient", $types)
$closedMethod = $method.MakeGenericMethod([Microsoft.Azure.Management.Storage.StorageManagementClient])
$arguments = $context, [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]::ResourceManager
$client = $closedMethod.Invoke($factory, $arguments)
return $client
}

function Get-StorageAccount {
param([string] $resourceGroupName, [string] $name)
$endpoints = New-Object PSObject -Property @{"Blob" = "https://$name.blob.core.windows.net/"}
$sa = New-Object PSObject -Property @{"Name" = $name; "ResourceGroupName" = $resourceGroupName;
"PrimaryEndpoints" = $endpoints
}
return $sa
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
<None Include="Assert.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="AzureRM.Storage.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Common.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
<Link>ScenarioTests\Assert.ps1</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
<Link>ScenarioTests\AzureRM.Storage.ps1</Link>
</None>
<None Include="..\..\Resources\Commands.Resources.Test\ScenarioTests\Common.ps1">
<Link>ScenarioTests\Common.ps1</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public void RunPsTestWorkflow(
helper.RMStorageDataPlaneModule,
helper.RMStorageModule,
helper.GetRMModulePath("AzureRM.Compute.psd1"),
helper.GetRMModulePath("AzureRM.Network.psd1"));
helper.GetRMModulePath("AzureRM.Network.psd1"),
"AzureRM.Storage.ps1");

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,9 @@ function Get-SqlDatabaseImportExportTestEnvironmentParameters ($testSuffix)
importBacpacUri = $importBacpacUri;
location = "Australia East";
version = "12.0";
databaseEdition = "Standard";
serviceObjectiveName = "S0";
databaseMaxSizeBytes = "5000000";
authType = "Sql";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,36 @@ function Test-ImportDatabase

if($operationName -eq $export){
# Export database.
$exportResponse = New-AzureRmSqlDatabaseExport -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageKeyType $params.storageKeyType -StorageKey $params.storageKey -StorageUri $params.exportBacpacUri -AdministratorLogin $params.userName -AdministratorLoginPassword $secureString -AuthenticationType Sql
$exportResponse = New-AzureRmSqlDatabaseExport -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageKeyType $params.storageKeyType -StorageKey $params.storageKey -StorageUri $params.exportBacpacUri -AdministratorLogin $params.userName -AdministratorLoginPassword $secureString -AuthenticationType $params.authType
Assert-NotNull $exportResponse
$operationStatusLink = $exportResponse.OperationStatusLink
$operationStatusLink = $exportResponse.OperationStatusLink
Assert-AreEqual $exportResponse.ResourceGroupName $params.rgname
Assert-AreEqual $exportResponse.ServerName $params.serverName
Assert-AreEqual $exportResponse.DatabaseName $params.databaseName
Assert-AreEqual $exportResponse.StorageKeyType $params.storageKeyType
Assert-Null $exportResponse.StorageKey
Assert-AreEqual $exportResponse.StorageUri $params.exportBacpacUri
Assert-AreEqual $exportResponse.AdministratorLogin $params.userName
Assert-Null $exportResponse.AdministratorLoginPassword
Assert-AreEqual $exportResponse.AuthenticationType $params.authType
}

if($operationName -eq $import){
$importResponse = New-AzureRmSqlDatabaseImport -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageKeyType $params.storageKeyType -StorageKey $params.storageKey -StorageUri $params.importBacpacUri -AdministratorLogin $params.userName -AdministratorLoginPassword $secureString -Edition Standard -ServiceObjectiveName S0 -DatabaseMaxSizeBytes 5000000 -AuthenticationType Sql
$importResponse = New-AzureRmSqlDatabaseImport -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageKeyType $params.storageKeyType -StorageKey $params.storageKey -StorageUri $params.importBacpacUri -AdministratorLogin $params.userName -AdministratorLoginPassword $secureString -Edition $params.databaseEdition -ServiceObjectiveName $params.serviceObjectiveName -DatabaseMaxSizeBytes $params.databaseMaxSizeBytes -AuthenticationType $params.authType
Assert-NotNull $importResponse
$operationStatusLink = $importResponse.OperationStatusLink
Assert-AreEqual $importResponse.ResourceGroupName $params.rgname
Assert-AreEqual $importResponse.ServerName $params.serverName
Assert-AreEqual $importResponse.DatabaseName $params.databaseName
Assert-AreEqual $importResponse.StorageKeyType $params.storageKeyType
Assert-Null $importResponse.StorageKey
Assert-AreEqual $importResponse.StorageUri $params.importBacpacUri
Assert-AreEqual $importResponse.AdministratorLogin $params.userName
Assert-Null $importResponse.AdministratorLoginPassword
Assert-AreEqual $importResponse.AuthenticationType $params.authType
Assert-AreEqual $importResponse.Edition $params.databaseEdition
Assert-AreEqual $importResponse.ServiceObjectiveName $params.serviceObjectiveName
Assert-AreEqual $importResponse.DatabaseMaxSizeBytes $params.databaseMaxSizeBytes
}

Assert-NotNull $operationStatusLink
Expand All @@ -98,8 +119,14 @@ function Test-ImportDatabase
Write-Output "Getting Status"
while($status -eq $statusInProgress){
$statusResponse = Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink $operationStatusLink
Write-Output "Import Export Status Message:" + $statusResponse.StatusMessage
Write-Output "Import Export Status Message:" + $statusResponse.StatusMessage
Assert-AreEqual $statusResponse.OperationStatusLink $operationStatusLink
$status = $statusResponse.Status
if($status -eq $statusInProgress){
Assert-NotNull $statusResponse.LastModifiedTime
Assert-NotNull $statusResponse.QueuedTime
Assert-NotNull $statusResponse.StatusMessage
}
}
Assert-AreEqual $status $statusSucceeded
Write-Output "ImportExportStatus:" + $status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ protected void RunPowerShellTest(params string[] scripts)
"ScenarioTests\\" + this.GetType().Name + ".ps1",
helper.RMProfileModule,
helper.RMResourceModule,
helper.RMStorageDataPlaneModule,
helper.RMStorageModule,
helper.RMStorageDataPlaneModule,
helper.GetRMModulePath(@"AzureRM.Insights.psd1"),
helper.GetRMModulePath(@"AzureRM.Sql.psd1"));
helper.GetRMModulePath(@"AzureRM.Sql.psd1"),
"AzureRM.Storage.ps1");
helper.RunPowerShellTest(scripts);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,22 @@ public string OperationStatusLink
/// Gets or sets the error message returned from the server.
/// </summary>
public string ErrorMessage { get; set; }

/// <summary>
/// Copies the model to a new class
/// </summary>
internal virtual AzureSqlDatabaseImportExportBaseModel Copy()
{
return new AzureSqlDatabaseImportExportBaseModel()
{
ResourceGroupName = ResourceGroupName,
ServerName = ServerName,
AdministratorLogin = AdministratorLogin,
AuthenticationType = AuthenticationType,
DatabaseName = DatabaseName,
StorageKeyType = StorageKeyType,
StorageUri = StorageUri
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ public string ServiceObjectiveName
public int DatabaseMaxSizeBytes
{
get; set;
}
}

/// <summary>
/// Copies the model to a new class
/// </summary>
internal override AzureSqlDatabaseImportExportBaseModel Copy()
{
return new AzureSqlDatabaseImportModel()
{
ResourceGroupName = ResourceGroupName,
ServerName = ServerName,
AdministratorLogin = AdministratorLogin,
AuthenticationType = AuthenticationType,
DatabaseName = DatabaseName,
StorageKeyType = StorageKeyType,
StorageUri = StorageUri,
Edition = Edition,
ServiceObjectiveName = ServiceObjectiveName,
DatabaseMaxSizeBytes = DatabaseMaxSizeBytes
};
}
}
}
Loading