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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ binaries/
[Rr]elease/
build/
restoredPackages/
PolicheckOutput/
tools/net46/
tools/Microsoft.WindowsAzure.Build.Tasks/packages/
PublishedNugets/
src/NuGet.Config
tools/7-zip/
Expand Down
59 changes: 21 additions & 38 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,54 +1,37 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="dirs.proj" />
<PropertyGroup>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)src</LibrarySourceFolder>
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
<LibraryNugetPackageFolder>$(LibraryRoot)\restoredPackages</LibraryNugetPackageFolder>
<LibraryFriendlyName>Microsoft Azure Management Libraries</LibraryFriendlyName>
<AuthenticationSolution>src\Authentication\Authentication.sln</AuthenticationSolution>
<ManagementLibrariesSolution>AzureManagementLibraries.sln</ManagementLibrariesSolution>
<BinariesFolder>$(LibraryRoot)binaries</BinariesFolder>
<BuiltPackageOutputDir>$(BinariesFolder)\packages</BuiltPackageOutputDir>
<DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign>
<CodeSign Condition=" '$(CodeSign)' == '' ">false</CodeSign>
<Scope Condition=" '$(Scope)' == '' ">All</Scope>
<NuGetCommand>&quot;$(LibraryToolsFolder)\nuget.exe&quot;</NuGetCommand>
<Import Project="dirs.proj" />
<PropertyGroup>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)src</LibrarySourceFolder>
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
<LibraryNugetPackageFolder>$(LibraryRoot)\restoredPackages</LibraryNugetPackageFolder>
<LibraryFriendlyName>Microsoft Azure Management Libraries</LibraryFriendlyName>
<AuthenticationSolution>src\Authentication\Authentication.sln</AuthenticationSolution>
<ManagementLibrariesSolution>AzureManagementLibraries.sln</ManagementLibrariesSolution>
<BinariesFolder>$(LibraryRoot)binaries</BinariesFolder>
<PoliCheckOutputDir>$(LibraryRoot)PolicheckOutput</PoliCheckOutputDir>
<BuiltPackageOutputDir>$(BinariesFolder)\packages</BuiltPackageOutputDir>
<DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign>
<CodeSign Condition=" '$(CodeSign)' == '' ">false</CodeSign>
<Scope Condition=" '$(Scope)' == '' ">All</Scope>
<NuGetCommand>&quot;$(LibraryToolsFolder)\nuget.exe&quot;</NuGetCommand>
<NuGetKey Condition=" '$(NuGetKey)' == '' ">1234</NuGetKey>
<BuildInParallel>true</BuildInParallel>
<NugetPackageName/>
<ImportDirectoryBuildTargets>true</ImportDirectoryBuildTargets>
<DefaultPathTokenToIgnore>$(IgnorePathTokens) Microsoft.Azure.KeyVault.Samples Gallery Intune FileConventions FileStaging ConfigureAwaitAnalyzer ObjectModelCodeGeneration Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests IntegrationTestCommon</DefaultPathTokenToIgnore>
<!--Microsoft.Azure.KeyVault.Samples
ClientRuntime.Azure.TestFramework
Condition=" '$(IgnorePathTokens)' == '' "
ClientRuntime.Azure.TestFramework Microsoft.Azure.Test.HttpRecorder
-->
</PropertyGroup>
<DefaultPathTokenToIgnore>$(IgnorePathTokens) Microsoft.Azure.KeyVault.Samples Gallery Intune FileConventions Batch.FileStaging.Tests ConfigureAwaitAnalyzer ObjectModelCodeGeneration Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests IntegrationTestCommon</DefaultPathTokenToIgnore>
</PropertyGroup>
<PropertyGroup>
<CIToolsPath>$(OnPremiseBuildTasks)</CIToolsPath>
<OnPremiseBuild Condition=" Exists($(OnPremiseBuildTasks)) ">true</OnPremiseBuild>
<OnPremiseBuild Condition=" ! Exists($(OnPremiseBuildTasks)) ">false</OnPremiseBuild>
</PropertyGroup>

<PropertyGroup>
<BuildInParallel>true</BuildInParallel>
</PropertyGroup>

<ItemGroup Condition="'$(PublishTestProjects)' == 'false' Or '$(PublishTestProjects)' == ''">
<LibrariesToBuild Include="$(LibrarySourceFolder)\$(Scope)\*.sln" Condition=" '$(Scope)' != 'all' " />
<LibrariesToBuild Include="$(LibrarySourceFolder)\**\*.sln" Exclude="$(LibrarySourceFolder)\KeyVault\Microsoft.Azure.KeyVault.Samples\Microsoft.Azure.KeyVault.Samples.sln" Condition=" '$(Scope)' == 'all' " />
<LibraryFxTargetList Include="$(FxTargetList)" />
<AutoRestLibraryFxTargetList Include="portable;net45" />
<ClientRuntimeProjects Include="$(LibrarySourceFolder)\ClientRuntime\**\*.xproj"/>
<ClientRuntimeTests Include="$(LibrarySourceFolder)\ClientRuntime\*.Tests\*.xproj"/>
<ClientRuntimeRootDir Include="%(ClientRuntimeProjects.RootDir)"/>
</ItemGroup>

<PropertyGroup Label="Well Known Properties">
<ClientRuntimeRootDir>$(LibraryRoot)src\UpgradeVS17\SdkCommon\ClientRuntime</ClientRuntimeRootDir>
<SdkCommonRootDir>$(LibraryRoot)src\UpgradeVS17\SdkCommon\ClientRuntime</SdkCommonRootDir>
</PropertyGroup>

<Import Project="tools\buildTargets\common.Build.props"/>
<Import Project="tools\buildTargets\common.NugetPackage.props" />
<Import Project="tools\buildTargets\common.Build.props"/>
<Import Project="tools\buildTargets\common.NugetPackage.props" />
</Project>
1 change: 1 addition & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Target Name="Build" DependsOnTargets="$(BuildTraversedProjectsDependsOn)" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="PublishNuget" DependsOnTargets="$(PublishNugetDependsOn)" />
<Target Name="CreateNugetPackage" DependsOnTargets="$(PackageNugetDependsOn)" />
<Target Name="RunTests" DependsOnTargets="$(RunTestProjectsDependsOn)" />
<Target Name="SignNuget" DependsOnTargets="$(SignNugetDependsOn)" />
<Target Name="Help" DependsOnTargets="$(HelpDependsOn)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ public void RoleAssignmentListForScopeTest()
}
}

//[Fact(Skip = "Graph issue when adding user to group, needs investigation")]
[Fact]
[Fact(Skip = "Graph issue when adding user to group, needs investigation")]
public void RoleAssignmentListWithAssignedToFilterTest()
{
HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@
<ItemGroup>
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170222-09" />
<!-- <PackageReference Include="Microsoft.NETCore.App" Version="1.0.2" /> -->
</ItemGroup>
<ItemGroup>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<!-- This is needed for discovering tests in test explorer -->
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<RestorePackagesPath>$(LibraryNugetPackageFolder)</RestorePackagesPath>
<NugetCommonProfileTags/>
<NugetCommonProfileTags />
<PackageOutputPath>$(BuiltPackageOutputDir)</PackageOutputPath>
<AddProjectReferenceForDebuggingPurpose>false</AddProjectReferenceForDebuggingPurpose>
<AddNugetReferenceForCIandCmdlineBuild>true</AddNugetReferenceForCIandCmdlineBuild>
Expand All @@ -25,7 +25,12 @@
<OutputPath>bin\$(Configuration)\</OutputPath>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.WebListener" Version="1.0.2" />
<PackageReference Include="xunit" Version="2.3.0-beta1-build3642" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta1-build1309" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170222-09" />
Expand All @@ -43,7 +48,7 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
</PropertyGroup>

<!--Do not remove until VS Test Tools fixes #472-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Azure.Batch.Unit.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Batch.Protocol;
using Microsoft.Net.Http.Server;
using Xunit;

public class HttpClientBehaviorTests
{
private const string url = "http://localhost:2055";

[Theory]
[MemberData(nameof(HttpMethods))]
public async Task HttpClient_IncludesContentLengthHeaderOnExpectedHttpVerbs(HttpMethod httpMethod)
{
BatchSharedKeyCredential creds = new BatchSharedKeyCredential(ClientUnitTestCommon.DummyAccountName, ClientUnitTestCommon.DummyAccountKey);

HttpRequestMessage message = new HttpRequestMessage(httpMethod, url);
message.Headers.Add("client-request-id", Guid.NewGuid().ToString());

await creds.ProcessHttpRequestAsync(message, CancellationToken.None);
Assert.NotNull(message.Headers.Authorization);

var settings = new WebListenerSettings()
{
Authentication = { Schemes = AuthenticationSchemes.None },
UrlPrefixes = { url }
};
using (WebListener listener = new WebListener(settings))
{
listener.Start();
Task listenTask = AcceptAndAssertAsync(httpMethod, listener, AssertRequestHasExpectedContentLength);

HttpClient client = new HttpClient();
await client.SendAsync(message);

await listenTask;
}
}

private static IEnumerable<object[]> HttpMethods()
{
yield return new[] { HttpMethod.Delete };
yield return new[] { HttpMethod.Post };
yield return new[] { HttpMethod.Get };
yield return new[] { HttpMethod.Head };
yield return new[] { new HttpMethod("PATCH") };
yield return new[] { HttpMethod.Put };
yield return new[] { HttpMethod.Options };
}

private static async Task AcceptAndAssertAsync(HttpMethod httpMethod, WebListener listener, Action<HttpMethod, RequestContext> assertLambda)
{
using (RequestContext ctx = await listener.AcceptAsync())
{
assertLambda(httpMethod, ctx);
ctx.Response.StatusCode = 200;
}
}

private static void AssertRequestHasExpectedContentLength(HttpMethod httpMethod, RequestContext ctx)
{
if (httpMethod == HttpMethod.Head || httpMethod == HttpMethod.Get)
{
Assert.DoesNotContain(ctx.Request.Headers.Keys, str => str == "Content-Length");
}
else if (httpMethod == HttpMethod.Delete || httpMethod == new HttpMethod("PATCH") || httpMethod == HttpMethod.Options)
{
#if !FullNetFx
Assert.DoesNotContain(ctx.Request.Headers.Keys, str => str == "Content-Length");
#else
Assert.Contains(ctx.Request.Headers.Keys, str => str == "Content-Length");
Assert.Equal("0", ctx.Request.Headers["Content-Length"].Single());
#endif
}
else if (httpMethod == HttpMethod.Post || httpMethod == HttpMethod.Put)
{
Assert.Contains(ctx.Request.Headers.Keys, str => str == "Content-Length");
Assert.Equal("0", ctx.Request.Headers["Content-Length"].Single());
}
else
{
throw new ArgumentException($"Unexpected HTTP request type: {httpMethod}");
}
}
}
}
4 changes: 2 additions & 2 deletions src/SDKs/Batch/DataPlane/Azure.Batch/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[assembly: AssemblyTitle("Microsoft.Azure.Batch")]
[assembly: AssemblyDescription("Client library for interacting with the Azure Batch service.")]

[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyVersion("7.0.1.0")]
[assembly: AssemblyFileVersion("7.0.1.0")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft Azure")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
Expand Down
2 changes: 1 addition & 1 deletion src/SDKs/Batch/DataPlane/Azure.Batch/Azure.Batch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<PackageId>Azure.Batch</PackageId>
<Description>This client library provides access to the Microsoft Azure Batch service.</Description>
<VersionPrefix>7.0.0</VersionPrefix>
<VersionPrefix>7.0.1</VersionPrefix>
<DefineConstants>$(DefineConstants);CODESIGN</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyName>Microsoft.Azure.Batch</AssemblyName>
Expand Down
12 changes: 10 additions & 2 deletions src/SDKs/Batch/DataPlane/Azure.Batch/Generated/PoolUsageMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,17 @@ public double TotalCoreHours
}

/// <summary>
/// Gets the size of virtual machine in the pool. All virtual machines in a pool are the same size. Azure Batch supports
/// all Azure virtual machine sizes except ExtraSmall.
/// Gets the size of the virtual machines in the pool. All virtual machines in a pool are the same size.
/// </summary>
/// <remarks>
/// <para>For information about available sizes of virtual machines for Cloud Services pools (pools created with
/// a <see cref="CloudServiceConfiguration"/>), see https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/.
/// Batch supports all Cloud Services VM sizes except ExtraSmall.</para><para>For information about available VM
/// sizes for pools using images from the Virtual Machines Marketplace (pools created with a <see cref="VirtualMachineConfiguration"/>)
/// see https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/ or https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/.
/// Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (for example STANDARD_GS,
/// STANDARD_DS, and STANDARD_DSV2 series).</para>
/// </remarks>
public string VirtualMachineSize
{
get { return this.virtualMachineSize; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,27 @@ public override Task ProcessHttpRequestAsync(HttpRequestMessage httpRequest, Can
signature.Append(httpRequest.Content != null && httpRequest.Content.Headers.Contains("Content-Language") ? httpRequest.Content.Headers.GetValues("Content-Language").FirstOrDefault() : string.Empty).Append('\n');

// Handle content length
if (httpRequest.Content != null)
{
signature.Append(httpRequest.Content.Headers.ContentLength.HasValue ? httpRequest.Content.Headers.ContentLength.ToString() : string.Empty).Append('\n');
}
else
long? contentLength = httpRequest.Content?.Headers?.ContentLength;

if (contentLength == null)
{
// Because C# httpRequest adds a content-length = 0 header for POST and DELETE even if there is no body, we have to
// sign the request knowing that there will be content-length set. For all other methods that have no body, there will be
// no content length set and thus we append \n with no 0.
if ((httpRequest.Method == HttpMethod.Delete) || (httpRequest.Method == HttpMethod.Post))
// Because C# httpRequest adds a content-length = 0 header for DELETE, PATCH, and OPTIONS even if there is no body (but only in netframework), we have to
// sign the request knowing that there will be content-length set.
#if FullNetFx
if (httpRequest.Method == HttpMethod.Delete || httpRequest.Method == new HttpMethod("PATCH") || httpRequest.Method == HttpMethod.Options)
{
signature.Append("0\n");
contentLength = 0;
}
else
#endif

// Because C# httpRequest adds a content-length = 0 header for POST even if there is no body, we have to
// sign the request knowing that there will be content-length set.
if (httpRequest.Method == HttpMethod.Post)
{
signature.Append('\n');
contentLength = 0;
}
}
signature.Append(contentLength).Append('\n');

signature.Append(httpRequest.Content != null && httpRequest.Content.Headers.Contains("Content-MD5") ? httpRequest.Content.Headers.GetValues("Content-MD5").FirstOrDefault() : string.Empty).Append('\n');
signature.Append(httpRequest.Content != null && httpRequest.Content.Headers.Contains("Content-Type") ? httpRequest.Content.Headers.GetValues("Content-Type").FirstOrDefault() : string.Empty).Append('\n');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
"Key": {
"Type": "string",
"Name": "VirtualMachineSize",
"SummaryComment": "The size of virtual machine in the pool. All virtual machines in a pool are the same size. Azure Batch supports all Azure virtual machine sizes except ExtraSmall.",
"RemarksComment": null,
"SummaryComment": "The size of the virtual machines in the pool. All virtual machines in a pool are the same size.",
"RemarksComment": "<para>For information about available sizes of virtual machines for Cloud Services pools (pools created with a <see cref=\"CloudServiceConfiguration\"/>), see https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/. Batch supports all Cloud Services VM sizes except ExtraSmall.</para><para>For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with a <see cref=\"VirtualMachineConfiguration\"/>) see https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/ or https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/. Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (for example STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).</para>",
"BoundAccess": "read",
"UnboundAccess": "none"
},
Expand Down
8 changes: 8 additions & 0 deletions src/SDKs/Batch/DataPlane/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
### Upcoming changes
These changes are planned but haven't been published yet.

### Changes in 7.0.1
#### Bug fixes
- Fixed a bug where requests using HTTP DELETE (for example, `DeletePool` and `DeleteJob`) failed with an authentication error in the netstandard package. This was due to a change made to `HttpClient` in netcore.
- This bug impacted the 6.1.0 release as well.

#### REST API version
This version of the Batch .NET client library targets version 2017-05-01.5.0 of the Azure Batch REST API.

### Changes in 7.0.0
#### License
Moved source code and NuGet package from Apache 2.0 license to MIT license. This is more consistent with the other Azure SDKs as well as other open source projects from Microsoft such as .NET.
Expand Down
Loading