Giter Site home page Giter Site logo

azure-libraries-for-net's People

Contributors

aimankhan avatar alvadb avatar anuchandy avatar anudeepsharma avatar chentanyi avatar dependabot[bot] avatar enjeej avatar eric-winkler avatar hovsepm avatar iscai-msft avatar jianghaolu avatar johan-lindvall-stratsys avatar karataliu avatar lenala avatar milismsft avatar nepomuceno avatar praries880 avatar rikkigibson avatar selvasingh avatar thomaslevesque avatar timlovellsmith avatar tomkerkhove avatar vjirovsky avatar vladimir-shcherbakov avatar wanxms avatar weidongxu-microsoft avatar weshaggard avatar xseeseesee avatar yaohaizh avatar yevster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-libraries-for-net's Issues

Implement .WithPlatformImage()

I tried to use the API to create a managed disk based on a platform image, but the method does not exist (based on my reading of the code). I wanted to customize an existing platform image, and the easiest way to do that is to start with a platform image.

I am refering to the API here: https://docs.microsoft.com/en-us/rest/api/compute/manageddisks/disks/disks-create-or-update for Create a managed disk from a platform image.

I was able to workaround the issue with the following code.

  var imageId = String.Format("/subscriptions/{0}/providers/Microsoft.Compute/locations/{1}/publishers/{2}/ArtifactTypes/vmimage/offers/{3}/skus/{4}/versions/{5}",
        subId,
        Region.USSouthCentral.Name,
        "credativ",
        "Debian",
        "9",
        "latest");
        
    var disk = azure.Disks.Define("mydebian9md")
        .WithRegion(Region.USSouthCentral)
        .WithExistingResourceGroup("my-md00")
        // .WithPlatformDisk(imageId)
        .WithLinuxFromDisk(imageId);
 
    // override the implementation to get the correct JSON document generated.       
    dynamic d = disk;
    var creationData = new CreationData(DiskCreateOption.FromImage, null, new ImageDiskReference(imageId, null), null, null);
    d.Inner.CreationData = creationData;

What about Azure Backup

Will there be support for Azure Backup Management in the Future?
Getting all backup items and theyr restore points
Restoring backup Points
Triggering new Backups etc.

Example for using low level libraries side by side with Fluent Libraries.

In the readme, it says "Libraries are built on the lower-level, request-response style auto generated clients and can run side-by-side with auto generated clients."

I was hoping to find an example and/or best practices on how to use the Fluent API and low-level libraries side by side. My thought was that I would step down to the low level libraries when I needed to manage something currently unsupported by the Fluent API.

IResourceManager GenericResources.CheckExistenceAsync call on existing VM fails with "503 Service Unavailable"

Both the Sync and Async version of API GenericResources.CheckExistenceAsync deadlock call gets stuck and finally fails with:

System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperations.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperationsExtensions.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.GenericResourcesImpl.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

VirtualMachines.Define using WithStoredWindowsImage - The api-version '2016-04-30-preview

From @pppchris on June 7, 2017 9:28

"ExceptionMessage": "The api-version '2016-04-30-preview' is invalid. The supported versions are '2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.",

When trying to create a VM using a custom image.

Copied from original issue: Azure/azure-sdk-for-net#3331

Fluent SDK: GenericResource: Create blows up with 'parentResourcePath' cannot be null

From @TimLovellSmith on September 7, 2017 21:26

I'm trying to use Fluent SDK 1.1.3 and GenericResource.Define.CreateAsync() to create a VMSS and it's not working. It looks like it is a client side validation error before the call to Azure (since I would never get to see a trace of the expected PUT request)

From the error message it seems like it is not working because it expects generic resource to only be used for child resources, not top-level??

[Deployment: iaas268, Id: 224] Fail CREATE IGENERICRESOURCE wus858288 'parentResourcePath' cannot be null. Microsoft.Rest.ValidationException: 'parentResourcePath' cannot be null.
   at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperations.<CreateOrUpdateWithHttpMessagesAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperationsExtensions.<CreateOrUpdateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.GenericResourceImpl.<CreateResourceAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AzCacheRP.Provisioning.IResourceExtensions.<CreateWithLoggingAsync>d__2`1.MoveNext() in C:\repo\cp\src\Provisioning\AzureCacheRP\Provisioning\Resources\IResourceExtensions.cs:line 63 T=+00:01:13.0759450

Copied from original issue: Azure/azure-sdk-for-net#3674

Cannot get full list of Virtual Machines

From @mxcolin on February 11, 2017 7:3

When I try to get a list of Virtual Machines it just returns the first VM and then nothing after that.

AzureCredentials credentials = AzureCredentials.FromServicePrincipal(this.Credentials.ClientID, this.Credentials.ClientSecret, this.Credentials.TenantID, AzureEnvironment.AzureGlobalCloud);

IAzure azure = azure.Configure().Authenticate(credentials).WithSubscription(this.Credentials.SubscriptionID);

foreach (IVirtualMachine vm in azure.VirtualMachines.List())
{
	// This loop runs once although I have 3 Virtual Machines
}

Additionally azure.ResourceGroups.List() never returns.

Copied from original issue: Azure/azure-sdk-for-net#2811

The string '00:30:00' is not a valid TimeSpan value.

When using the ISchedulerManager to work with Azure Scheduler and Collections and Jobs an error is raised when you provide a RetryPolicy.RetryInterval with an invalid TimeSpan on deserialisation from Azure. The actual operation is successful so this seems to just be an error during transit of the data.

Here is the stack trace:

at System.Xml.XmlConvert.ToTimeSpan(String s)
   at Microsoft.Rest.Serialization.Iso8601TimeSpanConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
   at Microsoft.Azure.Management.Scheduler.Fluent.JobsOperations.<CreateOrUpdateWithHttpMessagesAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Scheduler.Fluent.JobsOperationsExtensions.<CreateOrUpdateAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at My code calling ISchedulerManager.Inner.Jobs.CreateOrUpdateAsync(...)

Here's some test code I setup which provides the error:

var client = Microsoft.Azure.Management.Scheduler.Fluent.SchedulerManager(AzureCreds, SubscriptionID);
var collection = await client.Inner.JobCollections.CreateOrUpdateAsync("rsg", "collection-1", new JobCollectionDefinitionInner()
                {
                    Location = "UK South",
                    Name = "collection-1",
                    Properties = new JobCollectionProperties()
                    {
                        Sku = new Sku(SkuDefinition.Standard),
                        State = JobCollectionState.Enabled
                    }
                });
                var job = await client.Inner.Jobs.CreateOrUpdateAsync("rsg", "collection-1", "job-1", new JobPropertiesInner()
                {
                    State = JobState.Enabled,
                    Action = new JobAction()
                    {
                        Type = JobActionType.Https,
                        Request = new HttpRequest()
                        {
                            Headers = new Dictionary<string, string>() { { "User-Agent", "Azure Scheduler" } },
                            Method = "POST",
                            Uri = "https://www.example.com"
                        },
                        RetryPolicy = new RetryPolicy()
                        {
                            RetryType = RetryType.Fixed,
                            RetryCount = 12,
                            RetryInterval = new TimeSpan(0, 30, 0)
                        },
                        ErrorAction = new JobErrorAction()
                        {
                            Type = JobActionType.Https,
                            Request = new HttpRequest()
                            {
                                Headers = new Dictionary<string, string>() { { "User-Agent", "Azure Scheduler" } },
                                Method = "POST",
                                Uri = "https://www.example.com"
                            }
                        }
                    },
                    Recurrence = new JobRecurrence()
                    {
                        Frequency = RecurrenceFrequency.Day
                    },
                    StartTime = message.StartDate
                });

Exceptions not thrown

From @j055 on June 26, 2017 17:9

If the underlying HTTP request gives a 400 BadRequest no exception in thrown:

	var azure = Azure
			   .Configure()
			   .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
			   .Authenticate(credentials)
			   .WithDefaultSubscription();

	var webApp = azure.WebApps.GetByResourceGroup("rg", "app");

	webApp.Update()
				.DefineHostnameBinding()
				.WithThirdPartyDomain("mydomain.com")
				.WithSubDomain("test1")
				.WithDnsRecordType(CustomHostNameDnsRecordType.CName)
				.Attach()
				.Apply();

Copied from original issue: Azure/azure-sdk-for-net#3417

GraphRBAC ActiveDirectoryApplications.GetByName throws BadRequest

I am seeing BadRequest error thrown by Graph API when I call the Graph RBAC ActiveDirectoryApplications.GetByName() method
The Graph API error is:

{"odata.error":{"code":"Request_UnsupportedQuery","message":{"lang":"en","value":"Unsupported or invalid query filter clause specified for property 'appId' of resource 'Application'."}}}

Looking at the code the filter query for "appId eq ''" is failing. The query before it - "displayName eq ''" - returned nothing.

Fluent SDK version 1.1.3

Here's the captured request:

GET https://graph.windows.net/<REDACTED>/applications?$filter=appId%20eq%20'<REDACTED>'&api-version=1.6 HTTP/1.1
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Accept-Language: en-US
Authorization: Bearer <REDACTED>
User-Agent: FxVersion/4.6.25211.01 Microsoft.Azure.Management.Graph.RBAC.Fluent.GraphRbacManagementClient/1.1.3.0 MacAddressHash/f3a75dfd19a09371224b56bbba4d09aee55396e000a67ef307b07b7d651172ee
x-ms-client-request-id: 9985b3d0-30f7-4b87-adc8-8a6f3739d01b
Host: graph.windows.net

Just figured that this does not happen when the app name is a GUID. Not sure if this is a Fluent SDK bug or AAD issue.

Usage of WithPackageUri & local file

I tried to provide a local path "d:\packages\7.0.zip" as well as "file:///D:/packages/7.0.zip" - but get an exception for both cases:

'Failed to download package. AppGallery Deploy Failed: 'System.Net.WebException: Could not find a part of the path 'D:\packages\7.0.zip'.

Looking at https://github.com/Azure/azure-libraries-for-net/blob/master/Samples/AppService/ManageWebAppSourceControl.cs#L190 kind of suggests that only Web Urls are supported - is this true that I cannot provide a local file?

Thread-safety and memory leak bug in Fluent API Region class

From @Eldar1205 on August 27, 2017 14:49

I looked in fluent branch at source code of Region class and noticed a thread-safety bug and a memory leak bug due to usage of static regions dictionary. The thread-safety bug is that public Create method can call private constructor which adds an item to the static dictionary - user can call Create in parallel with different regions not already in the dictionary causing parallel mutation of the dictionary, which isn't a thread-safe operation. The second issue is that this same mutation of the dictionary can cause a memory leak if user has bug that constantly uses new unknown locations. I suggest to solve both by initializing the dictionary once in static constructor with all well-known regions, and when Create calls the private constructor for unknown region the private constructor won't manipulate the static regions dictionary. The Equals and GetHashCode implementations already support that, they don't assume each region instance is in the dictionary.

Copied from original issue: Azure/azure-sdk-for-net#3628

Implement RestartPolicy for Container Instances

Container instances can now have a restart policy applied to them in the latest version of the REST API but I cannot see this exposed in the fluent interface. Is it possible to add this? Thanks

App Service deploy WithSetParameter does not allow multiple parameters with the same name, e.g. skip

The semantics of the "skip" parameter of MsDeploy allows it to be specified multiple times per deploy, ref Windows Server 2016, but the implementation of the WithSetParameter is backed by a dictionary which, of course, probibits this.

I am trying to deploy an app service containing a web job.

The implementing method:
public WebDeploymentImpl<FluentT, FluentImplT, DefAfterRegionT, DefAfterGroupT, UpdateT> WithSetParameter

List methods exposed from Fluent API are not fully LAZY and do call the first page during initialization.

From @hovsepm on March 31, 2017 23:20

Instead we can think about ways to have fully LAZY collection that will do first page call only when caller will start iteration over the collection.

From internal discussion:
One of the design goal of foreach specifically handle this case i.e. iterating a source where data is not immediately available. Think about doing foreach on IEnumerable/IQuerable returned by SQL SELECT query, user knows that data can possibly reach page by page from SQL server and foreach iteration may block. And in this case query executes only when user iterate through the list or apply any LINQ operator that need data (e.g. First())

Between there is async enumerable in C# https://github.com/Reactive-Extensions/Rx.NET/tree/develop/Ix.NET . We should consider this after GA.

Copied from original issue: Azure/azure-sdk-for-net#3017

Missing OS Disk Size on many VMs

From @brharr on June 2, 2017 22:24

I am creating a Auditing based application where I am gathering information about a customer's IaaS architecture. When I pull the information about the OS Disk, in most cases the DiskSizeinGB property off of the IVirtualMachine.StorageProfile.OSDisk object as well as the IVirtualMachine.OSDiskSize property are returning either 0 or null. However, the values absolutely exist within the portal.

What is really weird is that is not ever VM. I have two virtual appliances that actually do return OS Disk sizes where as all other VMs that were created do not. I do not feel comfortable releasing this to the customer base without this information. Can someone please help here?

Thanks,
Brian CSA MIcrosoft

Copied from original issue: Azure/azure-sdk-for-net#3318

DNS fluent refresh work items

From @anuchandy on July 12, 2017 1:53

Following features are requested from service team (Same for java fluent as well):

Issue Resolution
The ability to set the TTL of a CNAME record set Will create โ€˜defineโ€™ and โ€˜updateโ€™ flows for CNAME similar to creating A records, include support for WithTimeToLive(n)
The ability to enumerate all record sets in a zone independent of record type (enumeration of specific types is supported) Add โ€˜ListRecordSetsโ€™ to IDnsZone in parallel with existing TxtRecordSets, NSRecordSets, etc
The ability to create multi-string TXT records (multiple strings in the same record, as opposed to multiple records per record set) Keep existing API signature, but allow long strings in each TXT record within the record set. On create/update, each long string should be chopped up into 255-character segments, and each segment placed into a separate string within the record On get, the separate strings within each record should be concatenated and returned as a single string. All this applies within each record in the record set. The record set is still a list of records No need for validation of string length limits etcโ€ฆjust let the server-side limits/errors apply.
The ability to specify the page size used during enumeration of zones or record sets expose an overload of List methods in DnsZones and RecordSets that takes OData top (integer) parameter.
Supporting new RecordSetNameSuffix query string parameter For each specific record sets collection model (AARecordSets, MxRecordSets etc..) expose an overload of List method that takes RecordSetNameSuffix parameter. We can also expose an overload of listRecordSets (see 2 that takes RecordSetNameSuffix parameter.
Access to If-Match / If-None-Match ETAG checks for concurrency protection By default, no etag checks (same as today) Get: Expose Etag as property Create: .WithEtagCheck() // Enable if-none-match * Update/Delete: .WithEtagCheck(etag-value) // Enable if-match <etag-value> Update: .WithEtagCheck() // Enable if-match using etag value retrieved during Apply. .WithEtagCheck(etag-value) // Enable if-match <etag-value> Delete: .WithEtagCheck(etag-value) // Enable if-match <etag-value> No need for GET before DELETE. All above applies to both zones and record sets.

Copied from original issue: Azure/azure-sdk-for-net#3481

System.Reflection.AmbiguousMatchException

System.Reflection.AmbiguousMatchException
Multiple custom attributes of the same type found.

StackTrace:


System.Attribute.GetCustomAttribute
Microsoft.Rest.ServiceClient`1.get_FrameworkVersion
Microsoft.Rest.ServiceClient`1.get_DefaultUserAgentInfoList
Microsoft.Rest.ServiceClient`1.SetUserAgent
Microsoft.Rest.ServiceClient`1.InitializeHttpClient
Microsoft.Azure.Management.Sql.Fluent.SqlManagementClient..ctor

I'm using Microsoft.Azure.Management.Sql.Fluent for do some operations on the database. My Code works just fine on my local environment but when I deploy it on Azure(Web app) and try to do the same operation it throws this exception.

Sample Code: (I can not share the actual code but this is all I can do)

var authContext = getAuthenticationContext(getAutority());
var clientCredential = getClientCredential(clientId, appKey);
var token = authContext.AcquireTokenAsync(resource, clientCredential).Result;            
   
var tokenCredentials = new TokenCredentials(token.AccessToken);         
// on this line it is throwing the error
var resourceClient = new ResourceManagementClient(tokenCredentials) { SubscriptionId = subscriptionId };

Outputs is always an empty collection when deploying a resource group

I'm able to deploy a resource group using the SDK. However, my RG returns a set of outputs which are not shown in the object model (even after calling Refresh() on the deployment). I've tested the same ARM template through the Azure CLI and the outputs are correctly returned.

Error copying SQL database within Elastic Pool

From @martijnkamphuis on September 12, 2017 11:24

First, let me sketch my situation (resource type - resource name). All resources are in one resource group:

  • SQL server - sql_server_A
    --- Elastic Pool - elastic_pool_1
    ----- database - template_db

  • SQL server - sql_server_B (no elastic pools or existing databases)

  • SQL server - sql_server_C
    --- Elastic Pool - elastic_pool_2

  • SQL server - sql_server_D
    --- Elastic Pool - elastic_pool_1 (name equal to Elastic Pool from sql_server_A)

Code being used:

ISqlDatabase template_db = /* Template database obtained from source server */;
ISqlServer sqlTargetServer = /* SQL server instance obtained */;
var dbDefinition = sqlTargetServer.Databases.Define("db_from_template");
var db = await dbDefinition.WithSourceDatabase(template_db)
			.WithMode(CreateMode.Copy)
			.CreateAsync();

I am trying to copy my 'template_db' from 'sql_server_A' to any of the other SQL servers. What works is copying either to the same SQL server (sql_server_A), or to a different SQL server containing an Elastic Pool with the name equal to the one where the template database is linked to (sql_server_D, elastic_pool_1).

In the other cases (copy to sql_server_B or sql_server_C), an exception is thrown:

{"Long running operation failed with status 'Failed'."}
   at Microsoft.Rest.Azure.AzureClientExtensions.<GetLongRunningOperationResultAsync>d__1`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Rest.Azure.AzureClientExtensions.<GetLongRunningOperationResultAsync>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Rest.Azure.AzureClientExtensions.<GetPutOrPatchOperationResultAsync>d__4`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Sql.Fluent.DatabasesOperations.<CreateOrUpdateWithHttpMessagesAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Sql.Fluent.DatabasesOperationsExtensions.<CreateOrUpdateAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Sql.Fluent.SqlDatabaseImpl.<CreateChildResourceAsync>d__87.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.IndependentChildImpl`7.<CreateResourceAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Test.AzureService.<CopyDatabase>d__9.MoveNext() in C:\xxx\Test\AzureService.cs:line 132

In the Azure portal, it is possible to copy the database to a target server AND configure the Elastic Pool or DatabaseEdition/pricing tier. These options are not available in the Fluent SDK when using .WithSourceDatabase and/or .WithMode. I believe this should be added.

Copied from original issue: Azure/azure-sdk-for-net#3684

RegistriesImpl: List..Async() methods not implemented

In RegistriesImpl 4 List...Async() methods not implemented:

protected override Task<IPage<Models.RegistryInner>> ListInnerAsync(CancellationToken cancellationToken)
        {
            throw new NotImplementedException();
        }

        protected override Task<IPage<Models.RegistryInner>> ListInnerNextAsync(string nextLink, CancellationToken cancellationToken)
        {
            throw new NotImplementedException();
        }

        protected override Task<IPage<Models.RegistryInner>> ListInnerByGroupAsync(string groupName, CancellationToken cancellationToken)
        {
            throw new NotImplementedException();
        }

        protected async override Task<IPage<Models.RegistryInner>> ListInnerByGroupNextAsync(string nextLink, CancellationToken cancellationToken)
        {
            return await Task.FromResult<IPage<Models.RegistryInner>>(null);
        }

Please note: same for ContainerServicesImpl.

Adding a certificate to the library which isn't bound to a host name

From @ajit-kolathur on May 9, 2017 22:4

Hi,

We use a certificate for client certificate authentication, the cert needs to be installed but it isn't bound to any host name. I noticed that the management library doesn't support adding a certificate which isnt bound to a host name. The azure portal supports this by having two separate features, adding a certificate and binding a certificate. Are there plans to support simple install of cert without biding?

Thanks

Copied from original issue: Azure/azure-sdk-for-net#3190

AppService AnalyzeCustomHostname method fails

From @MykhayloKonopelskyy on August 10, 2017 15:53

IAzure.WebApps
           .Inner
           .AnalyzeCustomHostname(
"WebAppResourceGroupName",
"WebAppName",
"Hostname")

throws exception

Unable to deserialize the response. (Inner exception - Unexpected character encountered while parsing value: <. Path '', line 0, position 0.). Because azure management api returns xml, but this fluent sdk expects json.

As a workaround, I can catch this SerializationException and parse manually xml from exception Content property.

Moreover, we can include Accept : "application/json" header to azure management api request and azure management api returns json, but json isn't correctly parsed by AnalyzeCustomHostnameWithHttpMessagesAsync(returned Body property has all properties with NULL values)

IAzure.WebApps
                .Inner
                .AnalyzeCustomHostnameWithHttpMessagesAsync(_WebAppResourceGroupName, _WebAppName, hostname, new Dictionary<string, List<string>> {{ "Accept", new List<string> { "application/json" }}}).Result;

I am using these packages under asp.net core (full .net targeting):
"Microsoft.Azure.Management.Fluent" Version="1.1.3"
"Microsoft.IdentityModel.Clients.ActiveDirectory" Version="2.28.4"

Copied from original issue: Azure/azure-sdk-for-net#3568

Issue pushing custom script extension via Fluent SDK

Hi,

We've been experiencing an issue with the Fluent SDK when trying to push a custom script extension to a VM. It seems that the command to execute we are pushing is not sent to the management API (or not being processed.) We keep seeing the error 'Invalid Configuration - CommandToExecute is not specified in the configuration; it must be specified in either the protected or public configuration section'. We have tried putting CommandToExecute in both the public and protected settings.

After investigating it further, we determined that the generic object types which denote the public and private settings are not being serialized. Originally we were calling

public async Task PushCustomScript(string rgName, string vmName, CloudBlobContainer deploymentContainer, CancellationToken tkn)
{
	var scriptRef = deploymentContainer.GetBlobReference(Config.Configure.TrainingFile);
	var account = deploymentContainer.ServiceClient.Credentials;

	var extensionProp = new VirtualMachineExtensionInner
	{
		Location = Config.Configure.Location,
		VirtualMachineExtensionType = "CustomScriptExtension",
		Publisher = "Microsoft.Compute",
		TypeHandlerVersion = "1.9",
		AutoUpgradeMinorVersion = true,
		Tags = new Dictionary<string, string>
		{
			{"DisplayName","Initiate-Training-Procedure"}
		},
		Settings = new
		{
			FileUris = new List<string>
			{
				scriptRef.Uri.AbsoluteUri
			}
		},
		ProtectedSettings = new
		{
			CommandToExecute = $"powershell -ExecutionPolicy Unrestricted -File ./{Config.Configure.TrainingFile} -accountName {account.AccountName} -key {Config.Configure.VmStorageKey} -endpoint {Config.Configure.VmStorageEndpoint}",
			StorageAccountName = account.AccountName,
			StorageAccountKey = account.ExportBase64EncodedKey()
		}
	};
	var result = await ComputeClient.VirtualMachineExtensions.CreateOrUpdateAsync(rgName, vmName, "Initiate-Training-Procedure", extensionProp, tkn);
	Config.Log.Info($"Triggered startup powershell script on vm {vmName}");
}

however after stepping into the source it appears that the Microsoft.Rest.Serialization.SafeJsonConvert serializer skips non-strongly defined objects.

As a work-around, we wrote a strongly-typed object for the CustomVmExtension however we don't believe it will work for other extensions. FYI the following is our work-around (highly copied from the Fluent source code).
Settings

public class Settings
{
	[JsonProperty(PropertyName = "fileUris")]
	public List<string> FileUris { get; set; }
}

ProtectedSettings Class

public class ProtectedSettings
{
	[JsonProperty(PropertyName = "commandToExecute")]
	public string CommandToExecute { get; set; }
	[JsonProperty(PropertyName = "storageAccountName")]
	public string StorageAccountName { get; set; }
	[JsonProperty(PropertyName = "storageAccountKey")]
	public string StorageAccountKey { get; set; }
}

Replacement AddVirtualMachineExtensionArgs Class

[Microsoft.Rest.Serialization.JsonTransformation]
public class AddVirtualMachineExtensionArgs : Resource
{
	[JsonProperty(PropertyName = "properties.forceUpdateTag")]
	public string ForceUpdateTag { get; set; }
	[JsonProperty(PropertyName = "properties.publisher")]
	public string Publisher { get; set; }
	[JsonProperty(PropertyName = "properties.type")]
	public string VirtualMachineExtensionType { get; set; }
	[JsonProperty(PropertyName = "properties.typeHandlerVersion")]
	public string TypeHandlerVersion { get; set; }
	[JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")]
	public bool? AutoUpgradeMinorVersion { get; set; }
	[JsonProperty(PropertyName = "properties.settings")]
	public Settings Settings { get; set; }
	[JsonProperty(PropertyName = "properties.protectedSettings")]
	public ProtectedSettings ProtectedSettings { get; set; }
	[JsonProperty(PropertyName = "properties.provisioningState")]
	public string ProvisioningState { get; }
	[JsonProperty(PropertyName = "properties.instanceView")]
	public VirtualMachineExtensionInstanceView InstanceView { get; set; }

}

Manual Extension Push Method

public async Task PushCustomScriptManually(string resourceGroupName, string vmName, CloudBlobContainer deploymentContainer, CancellationToken cancellationToken)
{
	var scriptRef = deploymentContainer.GetBlobReference(Config.Configure.TrainingFile);
	var account = deploymentContainer.ServiceClient.Credentials;
	var vmExtensionName = "Initiate-Training-Procedure";
	var _client = ComputeClient;
	Dictionary<string, List<string>> customHeaders = null;
	var extensionParameters = new AddVirtualMachineExtensionArgs
	{
		Location = Config.Configure.Location,
		VirtualMachineExtensionType = "CustomScriptExtension",
		Publisher = "Microsoft.Compute",
		TypeHandlerVersion = "1.9",
		AutoUpgradeMinorVersion = true,
		Tags = new Dictionary<string, string>
		{
			{"DisplayName",vmExtensionName}
		},
		Settings = new Settings
		{
			FileUris = new List<string>
			{
				scriptRef.Uri.AbsoluteUri
			}
		},
		ProtectedSettings = new ProtectedSettings
		{
			CommandToExecute = $"powershell -ExecutionPolicy Unrestricted -File ./{Config.Configure.TrainingFile} -accountName {account.AccountName} -key {Config.Configure.VmStorageKey} -endpoint {Config.Configure.VmStorageEndpoint}",
			StorageAccountName = account.AccountName,
			StorageAccountKey = account.ExportBase64EncodedKey()
		}
	};
	string apiVersion = "2016-04-30-preview";
	// Tracing
	bool _shouldTrace = ServiceClientTracing.IsEnabled;
	string _invocationId = null;
	if (_shouldTrace)
	{
		_invocationId = ServiceClientTracing.NextInvocationId.ToString();
		Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
		tracingParameters.Add("resourceGroupName", resourceGroupName);
		tracingParameters.Add("vmName", vmName);
		tracingParameters.Add("vmExtensionName", vmExtensionName);
		tracingParameters.Add("extensionParameters", extensionParameters);
		tracingParameters.Add("apiVersion", apiVersion);
		tracingParameters.Add("cancellationToken", cancellationToken);
		ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
	}
	// Construct URL
	var _baseUrl = _client.BaseUri.AbsoluteUri;
	var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString();
	_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
	_url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName));
	_url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName));
	_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(_client.SubscriptionId));
	List<string> _queryParameters = new List<string>();
	if (apiVersion != null)
	{
		_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
	}
	if (_queryParameters.Count > 0)
	{
		_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
	}
	// Create HTTP transport objects
	var _httpRequest = new System.Net.Http.HttpRequestMessage();
	System.Net.Http.HttpResponseMessage _httpResponse = null;
	_httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
	_httpRequest.RequestUri = new System.Uri(_url);
	// Set Headers
	if (_client.GenerateClientRequestId != null && _client.GenerateClientRequestId.Value)
	{
		_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
	}
	if (_client.AcceptLanguage != null)
	{
		if (_httpRequest.Headers.Contains("accept-language"))
		{
			_httpRequest.Headers.Remove("accept-language");
		}
		_httpRequest.Headers.TryAddWithoutValidation("accept-language", _client.AcceptLanguage);
	}
	if (customHeaders != null)
	{
		foreach (var _header in customHeaders)
		{
			if (_httpRequest.Headers.Contains(_header.Key))
			{
				_httpRequest.Headers.Remove(_header.Key);
			}
			_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
		}
	}
	// Serialize Request
	string _requestContent = null;
	if (extensionParameters != null)
	{
		_requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, _client.SerializationSettings);
		_httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
		_httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
	}
	// Set Credentials
	if (_client.Credentials != null)
	{
		cancellationToken.ThrowIfCancellationRequested();
		await _client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
	}
	// Send Request
	if (_shouldTrace)
	{
		ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
	}
	cancellationToken.ThrowIfCancellationRequested();
	_httpResponse = await _client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
	if (_shouldTrace)
	{
		ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
	}
	HttpStatusCode _statusCode = _httpResponse.StatusCode;
	cancellationToken.ThrowIfCancellationRequested();
	string _responseContent = null;
	if ((int)_statusCode != 200 && (int)_statusCode != 201)
	{
		var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
		try
		{
			_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
			CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, _client.DeserializationSettings);
			if (_errorBody != null)
			{
				ex = new CloudException(_errorBody.Message);
				ex.Body = _errorBody;
			}
		}
		catch (Newtonsoft.Json.JsonException)
		{
			// Ignore the exception
		}
		ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
		ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
		if (_httpResponse.Headers.Contains("x-ms-request-id"))
		{
			ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
		}
		if (_shouldTrace)
		{
			ServiceClientTracing.Error(_invocationId, ex);
		}
		_httpRequest.Dispose();
		if (_httpResponse != null)
		{
			_httpResponse.Dispose();
		}
		throw ex;
	}
	// Create Result
	var _result = new AzureOperationResponse<VirtualMachineExtensionInner>();
	_result.Request = _httpRequest;
	_result.Response = _httpResponse;
	if (_httpResponse.Headers.Contains("x-ms-request-id"))
	{
		_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
	}
	// Deserialize Response
	if ((int)_statusCode == 200)
	{
		_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
		try
		{
			_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<VirtualMachineExtensionInner>(_responseContent, _client.DeserializationSettings);
		}
		catch (Newtonsoft.Json.JsonException ex)
		{
			_httpRequest.Dispose();
			if (_httpResponse != null)
			{
				_httpResponse.Dispose();
			}
			throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
		}
	}
	// Deserialize Response
	if ((int)_statusCode == 201)
	{
		_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
		try
		{
			_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<VirtualMachineExtensionInner>(_responseContent, _client.DeserializationSettings);
		}
		catch (Newtonsoft.Json.JsonException ex)
		{
			_httpRequest.Dispose();
			if (_httpResponse != null)
			{
				_httpResponse.Dispose();
			}
			throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
		}
	}
	if (_shouldTrace)
	{
		ServiceClientTracing.Exit(_invocationId, _result);
	}
	var fullResponse = await ComputeClient.GetPutOrPatchOperationResultAsync(_result, customHeaders, cancellationToken).ConfigureAwait(false);
	Config.Log.Info($"Triggered startup powershell script on vm {vmName}");
}

Wrong name for management endpoint in AzureEnvironment class

In AzureEnvironment the management endpoint is spelled wrong:
grafik

The consequence is that in special clouds (like the german or chinese cloud) the resource management clients don't take the management url from the AzureCredentials but fall back to some global url, which, of course, is not valid for the special clouds.

Therefore, for every management client I have to set the url separately:

// log on
var servicecreds = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGermanCloud).WithDefaultSubscription(subscriptionId);

// create client:
SubscriptionClient subCli = new SubscriptionClient(servicecreds) {BaseUri = new Uri(servicecreds.Environment.ManagementEnpoint)};

WebApp SSL binding bug

From @j055 on August 31, 2017 14:2

#2935 - No update since June but this is still an issue in the latest release v1.2.

I've tested in a new web app with certificate installed. The certificate binding is not added.

           _webApp.Update()
                .WithClientCertEnabled(true)
                .DefineHostnameBinding()
                .WithThirdPartyDomain(domain)
                .WithSubDomain(subDomain)
                .WithDnsRecordType(CustomHostNameDnsRecordType.CName)
                .Attach()
                .Apply();

The API doesn't allow specifying IP or SNI and I have no idea why WithClientCertEnabled(true) is stuck there.

A better way might be:

            _webApp.Update()
                .DefineSslBinding()
                .ForHostname(domain)
                .WithExistingCertificate(thumbprint)
                .WithSniBasedSsl()
                .Attach()
                .Apply();

Thanks
Andrew

Copied from original issue: Azure/azure-sdk-for-net#3643

Support Azure CLI authentication in Fluent library

If using the Azure SDK within the context of e.g. VSTS - which has support for Azure authentication built-in for e.g. Powershell and Azure CLI - it would be very useful to be able to take the "transient" authentication from there. This is important for us as we want to be able to launch a .NET program during a release which will, among other things, perform an ARM deployment.

At the moment, the only way to get a handle to IAzure seems to be to do an explicit authentication in code.

Azure Container Instance (aci) State not returned

When listing Container Groups By Resource Group, the state of a Azure container instance the State property returns null:

var sp = new ServicePrincipalLoginInformation
            {
                ClientId = "<ClientId>",
                ClientSecret = "<ClientSecret>"
            };
var credentials = new AzureCredentials(sp, "<tenantId>", AzureEnvironment.AzureGlobalCloud);
var azure = Azure.Authenticate(credentials);

var containerGroups = await azure.WithSubscription("<subid>")
                            .ContainerGroups
                            .ListByResourceGroupAsync("resourcegroup1");

var containerGroup = containerGroups.FirstOrDefault(x => x.Name == "acigroupname");
containerGroup.State == null

Whereas when you get by resource group it returns the correct value:

var containerGroup = await azure.WithSubscription("<subid>")
                            .ContainerGroups.GetByResourceGroupAsync("resourcegroup1", "acigroupname");
containerGroup.State == "Running"

How do I create an SSL binding when the certificate is already installed?

From @j055 on March 14, 2017 21:5

I have a wildcard certificate installed in the webapp. How do I create an SSL Binding to a certificate which is already installed? I was expecting to specify the thumbprint but it looks like I have to upload the cert every time I create a binding.

app1 = app1.Update()
                                .WithManagedHostnameBindings(domain, app1Name)
                                .DefineSslBinding()
                                    .ForHostname(app1Name + "." + domainName)
                                    .WithPfxCertificateToUpload("Asset/" + pfxPath, CertificatePassword)
                                    .WithSniBasedSsl()
                                    .Attach()
                                .Apply();

Thanks
Andrew

Copied from original issue: Azure/azure-sdk-for-net#2935

Fluent SDK: GenericResources: Is it possible to define 'sku' if you use GenericResources.Define()?

From @TimLovellSmith on September 7, 2017 20:41

I tried to use the azureSub.GenericResources.Define(Name) API but I can't see what should be the way to define that it should have a top-level property SKU like '
"sku": {
"name": "Standard_A1",
"tier": "Standard",
"capacity": 10
},
' (as opposed to a property in its 'properties' bag? Or is this just a documentation issue that I am misunderstanding the usage of .WithProperties()?)

Copied from original issue: Azure/azure-sdk-for-net#3673

Can't attach CustomDomain to a web app

From @glaidler on July 24, 2017 13:4

Hi,

The following code won't attach a correctly set up DNS set to an existing web app:

.GetById(tenant.AppInstanceId).Update()
                    .DefineHostnameBinding()
                    .WithThirdPartyDomain("myapp.com")
                    .WithSubDomain("tenant")
                    .WithDnsRecordType(CustomHostNameDnsRecordType.A)
                    .Attach().Apply();

I have A Record pointing to the web app IP Address and a TXT record:

tenant.myapp.com > myapp.azurewebsites.net

What am I doing wrong?

Copied from original issue: Azure/azure-sdk-for-net#3509

AzureCredentials should implement an interface.

From @twitchax on April 7, 2017 20:55

Developers may have other means of authentication, such as an access token.

As of today, Azure.Authenticate takes an instance of AzureCredentials. The pertinent functionality of AzureCredentials should be abstracted to an interface so developers can implement the functionality themselves.

Copied from original issue: Azure/azure-sdk-for-net#3046

Add support for HTTPS Only on AppService/WebApp

There is a new setting for AppServices/WebApps under Custom domains called HTTPS Only. When enabled, all HTTP traffic will be redirected to HTTPS. I would like to be able to set this using the Fluent API.

image

Error listing AppService certificates using fluent api

From @NicolaiPetri on July 11, 2017 7:46

When fetching the list of certificates for specific subscription I'll get the following exception:
"Unable to deserialize the response."
Microsoft.Rest.SerializationException

The code that fails is
var certificates = azure.AppServices.AppServiceCertificates.List();

The full exception is here :

Exception: Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Microsoft.Azure.Management.AppService.Fluent.Models.Page'1[Microsoft.Azure.Management.AppService.Fluent.Models.CertificateInner]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
 To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
 Path '', line 1, position 1.
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
    at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
    at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
    --- End of inner exception stack trace ---
    at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperationsExtensions.<ListAsync>d__1.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Azure.Management.AppService.Fluent.AppServiceCertificatesImpl.<ListInnerAsync>d__4.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Azure.Management.ResourceManager.Fluent.Core.TopLevelModifiableResources`5.List()
    at Microsoft.Azure.Management.AppService.Fluent.AppServiceCertificatesImpl.Microsoft.Azure.Management.ResourceManager.Fluent.Core.CollectionActions.ISupportsListing<Microsoft.Azure.Management.AppService.Fluent.IAppServiceCertificate>.List()
    at AzureExporter2.ResourceIdCachedService.GetResourceId(IAzure azure, String resourceId, String resourceType, String resourceName) in C:\Projects\Dashboard\azure_exporter\AzureExporter2\ResourceIdCachedService.cs:line 47
    at AzureExporter2.Program.<>c__DisplayClass1_0.<Main>b__1(IAsyncResult ar) in C:\Projects\Dashboard\azure_exporter\AzureExporter2\Program.cs:line 88

I can on request provide the failing and valid json response in a private message.

Copied from original issue: Azure/azure-sdk-for-net#3474

'Authorization' header is missing with Certificate Credentials when creating KeyVault

Full disclosure, I am a Microsoft employee on the Azure team. (alias styackel).

I'm getting an odd exception when attempting to use a management certificate to authenticate when creating a key vault.

It is giving me this exception:
Authentication failed. The 'Authorization' header is missing. at Microsoft.Azure.Management.KeyVault.Fluent.VaultsOperations.<CreateOrUpdateWithHttpMessagesAsync>d__5.MoveNext()
etc.

Shouldn't the authorization header not be needed in this case, or am I missing something?

var managementCertificate = EncryptionUtils.GetCertificateFromStore(this.ManagementCertificateThumbprint);

using (var client = new KeyVaultManagementClient(new CertificateCredentials(managementCertificate)))
{
	client.SubscriptionId = this.SubscriptionId;

	var result = client.Vaults.CreateOrUpdateAsync(this.ResourceGroupName, this.KeyVaultName, new VaultCreateOrUpdateParametersInner
	{
		Properties = new VaultProperties
		{
			Sku = new Sku() { Name = SkuName.Standard },
			EnabledForDeployment = true,
			EnabledForDiskEncryption = true,
			EnabledForTemplateDeployment = true,
			AccessPolicies = new List<AccessPolicyEntry>()
			{
				new AccessPolicyEntry()
				{
					ApplicationId = Guid.Parse(this.AadApplicationId),
					TenantId = Guid.Parse(this.AadApplicationId),
					Permissions = new Permissions() { Certificates = new List<string>() {"all"}, Keys = new List<string>() {"all"}, Secrets = new List<string>() {"all"} },
					ObjectId = ""
				}
			}
		},
		Location = this.ResourceGroupLocation
	}).Result;
}

Fluent: NullReferenceException in VirtualMachineScaleSetImpl.LoadCurrentPrimaryLoadBalancersIfAvailable

From @TimLovellSmith on September 5, 2017 18:57

I'm hitting an NRE in Fluent SDK 1.1.3. The scenario involves creating a VMSS with an internal load balancer only (no public facing load balancer), and then trying to update it with a custom script extension

            vmssWithLB = vmssWithVNet
                .WithoutPrimaryInternetFacingLoadBalancer()
                .WithExistingPrimaryInternalLoadBalancer(loadBalancer)
                .WithPrimaryInternalLoadBalancerBackends(LoadBalancerResource.BackendName)
                .WithPrimaryInternalLoadBalancerInboundNatPools(
                    LoadBalancerResource.NatPool130XXName,
                    LoadBalancerResource.NatPool150XXName,
                    LoadBalancerResource.NatPool160XXName,
                    LoadBalancerResource.NatPool330XXName);
vmss.Update().DefineNewExtension(extensionName)
                            .WithPublisher("Microsoft.Compute")
                            .WithType("CustomScriptExtension")
                            .WithVersion("1.8")
                            .WithPublicSetting("fileUris", new string[] { scriptBlobSasUri.AbsoluteUri })
                            .WithProtectedSetting("storageAccountName", tenantStorage.AccountName)
                            .WithProtectedSetting("storageAccountKey", tenantStorage.GetSecretKey())
                            .WithProtectedSetting("commandToExecute", commandToExecute)
                            .Attach().ApplyAsync();

Here is the stack trace:

   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetImpl.LoadCurrentPrimaryLoadBalancersIfAvailable()
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetImpl.SetPrimaryIPConfigurationBackendsAndInboundNatPools()
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetImpl.<CreateInnerAsync>d__290.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.GroupableParentResource`8.<CreateResourceAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.CreatableUpdatable`5.<ApplyAsync>d__3.MoveNext()```

_Copied from original issue: Azure/azure-sdk-for-net#3659_

Provide validation or enums for Service Level Tiers

Currently all service level tiers, such as database tiers, are all strings.

It is currently very hard to build applications to validate input for these things.
Are there plans to introduce enums or validation components which we can use to validate input on?

I'm aware of classes such as DatabaseEditions but these are not really helping since we need to check each property of these classes instead of having a TryParse on an enum.

Starting/Stopping web app doesn't reflect in portal

From @garybushey on August 8, 2017 13:2

If I get a web app using GetByResourceGroup and then either call Start() or Stop() on it, the status is not reflected correctly in the Azure Portal.

If it is running in the portal and then use code to stop it, the portal will still say running but if I try to access it via the URL I get the message that it is not running.

Likewise if I stop it in the portal and start it in code, the portal will still say it is stopped but I can access it via the URL.

If I look at the Inner:properties.state that has the correct value. I am using V1.1.3 of the management packages.

Copied from original issue: Azure/azure-sdk-for-net#3561

Update example to use AzureCredentials instead of CredFile

original PR opened by @awesley

According to https://github.com/Azure/azure-sdk-for-net/blob/4c6f0794b9a27a386fc43ddd5396dcf327b9f340/AUTH.md

Using a credential file is not necessary the best practice for authenticating against Azure. Programmatic keys are a good choice for any "API first" documentation, so this update makes that change.

It also includes a comment with the entire namespace of the AzureCredentialsFactory type because it exists in multiple namespaces. They may all be valid, but this one works and a comment may lower the barrier of entry if someone were to hit that problem.

PR opened - Azure/azure-sdk-for-net#3174

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.