Skip to content
Merged
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 @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.2-preview" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<PackageReference Include="Azure.Batch" Version="8.1.1" />
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="1.1.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.0.2-preview" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\WindowsAzure.Storage.9.2.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\WindowsAzure.Storage.9.3.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<package id="Microsoft.Rest.ClientRuntime.Azure.TestFramework" version="1.5.0-preview" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
<package id="System.Spatial" version="5.8.2" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="9.2.0" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="9.3.0" targetFramework="net452" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="8.2.0-preview" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<Reference Include="Microsoft.Data.Services.Client, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.8.2\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming this will be undone once the new SDK is released.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will update all the reference when the XSCL is release. Currently remove the “PublicKeyToken” only to make the private XSCL work.

<HintPath>..\..\..\packages\WindowsAzure.Storage.9.2.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\WindowsAzure.Storage.9.3.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<package id="Microsoft.Data.Services.Client" version="5.8.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
<package id="System.Spatial" version="5.8.2" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="9.2.0" targetFramework="net452" />
</packages>
<package id="WindowsAzure.Storage" version="9.3.0" targetFramework="net452" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="0.7.2" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="0.7.3" />
<PackageReference Include="MSTest.TestAdapter" Version="1.2.1" />
<PackageReference Include="MSTest.TestFramework" Version="1.2.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@
<Reference Include="Microsoft.WindowsAzure.Management">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\WindowsAzure.Storage.9.2.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\WindowsAzure.Storage.9.3.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.7.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.DataMovement.0.7.2\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.7.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.DataMovement.0.7.3\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public void ValidateParseServicePropertiesTest()
serviceProperties.DeleteRetentionPolicy = new DeleteRetentionPolicy();
serviceProperties.DeleteRetentionPolicy.Enabled = true;
serviceProperties.DeleteRetentionPolicy.RetentionDays = 5;
serviceProperties.StaticWebsite = new StaticWebsiteProperties();
serviceProperties.StaticWebsite.Enabled = true;
serviceProperties.StaticWebsite.IndexDocument = "IndexDocument";
serviceProperties.StaticWebsite.ErrorDocument404Path = "ErrorDocument404Path";
PSSeriviceProperties pSSeriviceProperties = new PSSeriviceProperties(serviceProperties);
CompareServiceProperties(pSSeriviceProperties, serviceProperties);

Expand Down Expand Up @@ -119,6 +123,12 @@ static private void CompareServiceProperties(PSSeriviceProperties pSSeriviceProp
Assert.AreEqual(serviceProperties.DeleteRetentionPolicy.Enabled, pSSeriviceProperties.DeleteRetentionPolicy.Enabled);
Assert.AreEqual(serviceProperties.DeleteRetentionPolicy.RetentionDays, pSSeriviceProperties.DeleteRetentionPolicy.RetentionDays);
}
if ((pSSeriviceProperties != null && pSSeriviceProperties.StaticWebsite != null) || (serviceProperties != null && serviceProperties.StaticWebsite != null))
{
Assert.AreEqual(serviceProperties.StaticWebsite.Enabled, pSSeriviceProperties.StaticWebsite.Enabled);
Assert.AreEqual(serviceProperties.StaticWebsite.IndexDocument, pSSeriviceProperties.StaticWebsite.IndexDocument);
Assert.AreEqual(serviceProperties.StaticWebsite.ErrorDocument404Path, pSSeriviceProperties.StaticWebsite.ErrorDocument404Path);
}
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Commands.Storage.Test/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Storage.DataMovement" version="0.7.2" targetFramework="net452" />
<package id="Microsoft.Azure.Storage.DataMovement" version="0.7.3" targetFramework="net452" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.7-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
Expand All @@ -24,7 +24,7 @@
<package id="System.Linq.Queryable" version="4.0.0" targetFramework="net45" />
<package id="System.Net.Requests" version="4.0.11" targetFramework="net45" />
<package id="System.Spatial" version="5.8.2" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="9.2.0" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="9.3.0" targetFramework="net452" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
Expand Down
4 changes: 3 additions & 1 deletion src/Storage/Commands.Storage/Azure.Storage.Netcore.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ CmdletsToExport = 'Get-AzureStorageTable', 'New-AzureStorageTableSASToken',
'Update-AzureStorageServiceProperty',
'Get-AzureStorageServiceProperty',
'Enable-AzureStorageDeleteRetentionPolicy',
'Disable-AzureStorageDeleteRetentionPolicy'
'Disable-AzureStorageDeleteRetentionPolicy',
'Enable-AzureStorageStaticWebsite',
'Disable-AzureStorageStaticWebsite'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
10 changes: 7 additions & 3 deletions src/Storage/Commands.Storage/Azure.Storage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '4.4.0'
ModuleVersion = '4.4.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -121,7 +121,9 @@ CmdletsToExport = 'Get-AzureStorageTable', 'New-AzureStorageTableSASToken',
'Stop-AzureStorageBlobCopy', 'Update-AzureStorageServiceProperty',
'Get-AzureStorageServiceProperty',
'Enable-AzureStorageDeleteRetentionPolicy',
'Disable-AzureStorageDeleteRetentionPolicy'
'Disable-AzureStorageDeleteRetentionPolicy',
'Enable-AzureStorageStaticWebsite',
'Disable-AzureStorageStaticWebsite'

# Variables to export from this module
# VariablesToExport = @()
Expand Down Expand Up @@ -158,7 +160,9 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Support creating Storage Context with OAuth credentials.'
ReleaseNotes = '* Support Static Website configuration
- Enable-AzureStorageStaticWebsite
- Disable-AzureStorageStaticWebsite'

# Prerelease string of this module
Prerelease = 'preview'
Expand Down
5 changes: 5 additions & 0 deletions src/Storage/Commands.Storage/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
-->
## Current Release

## Version 4.4.1
* Support Static Website configuration
- Enable-AzureStorageStaticWebsite
- Disable-AzureStorageStaticWebsite

## Version 4.3.1
* Added additional information about -Permissions parameter in help files.

Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Commands.Storage/Commands.Storage.Netcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="0.7.2" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="0.7.3" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions src/Storage/Commands.Storage/Commands.Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\WindowsAzure.Storage.9.2.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\WindowsAzure.Storage.9.3.0\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.7.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.DataMovement.0.7.2\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.7.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Storage.DataMovement.0.7.3\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -95,6 +95,8 @@
<Compile Include="Common\BlobToFileSystemNameResolver.cs" />
<Compile Include="Blob\Cmdlet\StartAzureStorageBlobCopy.cs" />
<Compile Include="Blob\Cmdlet\StopAzureStorageBlobCopy.cs" />
<Compile Include="Common\Cmdlet\DisableAzureStorageStaticWebsite.cs" />
<Compile Include="Common\Cmdlet\EnableAzureStorageStaticWebsite.cs" />
<Compile Include="Common\Cmdlet\GetAzureStorageServiceProperties.cs" />
<Compile Include="Common\Cmdlet\DisableAzureStorageDeleteRetentionPolicy.cs" />
<Compile Include="Common\Cmdlet\NewAzureStorageAccountSasToken.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet
{
using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using System;
using System.Management.Automation;
using System.Security.Permissions;

/// <summary>
/// Disable azure storage service StaticWebsite, currently only available on Blob service
/// </summary>
[Cmdlet(VerbsLifecycle.Disable, StorageNouns.ServiceStaticWebsite, SupportsShouldProcess = true),
OutputType(typeof(PSStaticWebsiteProperties))]
public class DisableAzureStorageServiceStaticWebsiteCommand : StorageCloudBlobCmdletBase
{
[Parameter(Mandatory = false)]
public SwitchParameter PassThru { get; set; }

// Overwrite the useless parameter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these about? to set them in the tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter will show the user the StaticWebsite setting after the change. So they can have a check.
This is aligned with other serverproperty cmdlets like

enable/disable-AzureStorageDeleteRetentionPolicy
Set-AzureStorageServiceLoggingProperty
Set-AzureStorageServiceMetricsProperty
Set-AzureStorageServiceProperty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "Overwrite the useless parameter".. these dont seem useless :)

public override int? ServerTimeoutPerRequest { get; set; }
public override int? ClientTimeoutPerRequest { get; set; }
public override int? ConcurrentTaskCount { get; set; }

public DisableAzureStorageServiceStaticWebsiteCommand()
{
EnableMultiThread = false;
}

/// <summary>
/// Update the specified StaticWebsite Properties according to the input
/// </summary>
/// <param name="policy">StaticWebsite Properties</param>
internal void DisableStaticWebsiteProperties(ServiceProperties serviceProperties)
{
if (serviceProperties.StaticWebsite == null)
{
serviceProperties.StaticWebsite = new StaticWebsiteProperties();
}

serviceProperties.StaticWebsite.Enabled = false;
serviceProperties.StaticWebsite.IndexDocument = null;
serviceProperties.StaticWebsite.ErrorDocument404Path = null;
}

/// <summary>
/// Execute command
/// </summary>
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public override void ExecuteCmdlet()
{
StorageServiceType serviceType = StorageServiceType.Blob;

if (ShouldProcess(serviceType.ToString(), "Disable Static Website"))
{
ServiceProperties serviceProperties = Channel.GetStorageServiceProperties(serviceType, GetRequestOptions(serviceType), OperationContext);

DisableStaticWebsiteProperties(serviceProperties);

Channel.SetStorageServiceProperties(serviceType, serviceProperties,
GetRequestOptions(serviceType), OperationContext);

if (PassThru)
{
WriteObject(PSStaticWebsiteProperties.ParsePSStaticWebsiteProperties(serviceProperties.StaticWebsite));
}
}
}
}
}
Loading