I need to create programmaticaly an elastic pool. Here is my code :
var credentials = new Microsoft.Rest.TokenCredentials(await GetToken());
var sqlclient = new Microsoft.Azure.Management.Sql.SqlManagementClient(credentials) { SubscriptionId = subscriptionId };
var sqlServer = (await sqlclient.Servers.GetWithHttpMessagesAsync("MyApp-com","myApp-com")).Body;
var azurePool = (await sqlclient.ElasticPools.CreateOrUpdateWithHttpMessagesAsync("MyApp-com",sqlServer.Name,"poolname", new Microsoft.Azure.Management.Sql.Models.ElasticPool(sqlServer.Location, edition:"Basic",dtu:5))).Body;
I'm using :
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Resources" Version="2.20.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.6.0-preview" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.10" />
I'm getting this exception on the last line:
Microsoft.Rest.Azure.CloudException occurred
HResult=0x80131500
Message=Invalid value for header 'x-ms-request-id'. The header must contain a single valid GUID.
Source=<Cannot evaluate the exception source>
StackTrace:
at Microsoft.Azure.Management.Sql.ElasticPoolsOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__15.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Sql.ElasticPoolsOperations.<CreateOrUpdateWithHttpMessagesAsync>d__7.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
And as you can see here, 'x-ms-request-id' is NOT a valid guid ( but RequestId property is ):
Could you help me with this please ? Is the library not yet stable for CRUD ?
I also can reproduce it with .net core 2.0. And we also could use the way that mentioned in the another SO thread to solve it,even we don't have application Insights. More details please refer to the blog. In your case we need to change dtu to equal or larger than 50, for basic version at least 50 dtu. Following is my detail steps:
1.Create .net core 2.0 Asp.net project.
2.Add the following code in the Startup.cs file.
private void DisableCorrelationIdHeaders(IServiceCollection services)
{
var module = services.FirstOrDefault(t => t.ImplementationFactory?.GetType() == typeof(Func<IServiceProvider, DependencyTrackingTelemetryModule>));
if (module != null)
{
services.Remove(module);
services.AddSingleton<ITelemetryModule>(provider => new DependencyTrackingTelemetryModule { SetComponentCorrelationHttpHeaders = false });
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddApplicationInsightsTelemetry();
DisableCorrelationIdHeaders(services);
}
3.We need to change the dtu to 50 for basic version.
var azurePool = (await sqlclient.ElasticPools.CreateOrUpdateWithHttpMessagesAsync("MyApp-com",sqlServer.Name,"poolname", new Microsoft.Azure.Management.Sql.Models.ElasticPool(sqlServer.Location, edition:"Basic",dtu:50))).Body; //at least 50 for basic version
4.Test it locally,it works correctly on my side.
5.Check from the Azure portal
Sometime the error messages on the API's are a bit misleading.
Have you tried setting eDTU to 50?
This is the minimum eDTU's you can use for the Basic Tier you're trying to create:
https://azure.microsoft.com/en-us/pricing/details/sql-database/
User contributions licensed under CC BY-SA 3.0