Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
379 stars 193 forks source link

[BUG] Deployment Outputs object is not set on deployments created with Fluent API. #822

Closed AlexeyEvlampiev closed 4 years ago

AlexeyEvlampiev commented 4 years ago

Description Deployment Outputs object is not set on deployments created with Fluent API.

To Reproduce Steps to reproduce the behavior:

  1. Create an ARM template producing some basic outputs, e.g. { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [], "outputs": { "result": { "type": "string", "value": "Ok" } } }
  2. Initialize an azure object of the Microsoft.Azure.Management.Fluent.IAzure type, as described in https://docs.microsoft.com/en-us/azure/virtual-machines/windows/csharp-template
  3. Deploy the above template (templateJson- parameter) to an existing resource group ( resourceGroup parameter) with var deployment = azure.Deployments.Define($"myDeployment") .WithExistingResourceGroup(resourceGroup) .WithTemplate(templateJson) .WithParameters("{}") .WithMode(Microsoft.Azure.Management.ResourceManager.Fluent.Models.DeploymentMode.Incremental).Create(); Debug.Assert(deployment.Outputs != null);

Code Snippet Debug.Assert(deployment.Outputs != null);

Expected behavior The Debug.Assert(deployment.Outputs != null) assertion should pass.

Setup:

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

alex-frankel commented 4 years ago

Hi Alexey,

I'm working on finding the team that manages this particular set of APIs to get more details on the fix we need to make. We manage the core .NET SDK, but not the Fluent APIs. Hoping to have an update to you tomorrow or Monday. Thanks in advance for your patience!

Alex

yaohaizh commented 4 years ago

@AlexeyEvlampiev this is an issue of fluent SDK.

For now, you can query the object via

                    deployment = resourceManager.Deployments.GetByResourceGroup(rgName, deploymentName1);

to populate the result.

yaohaizh commented 4 years ago

Fix: https://github.com/Azure/azure-libraries-for-net/pull/830

AlexeyEvlampiev commented 4 years ago

Thanks, @yaohaizh. The outputs object is indeed populated this way.

ghost commented 4 years ago

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

bwfilms commented 3 years ago

I still encounter this problem. I'm running on Mac OS 10.15.7, .NET Core 5.0.21, and Microsoft.Azure.Management.Fluent 1.37.1.

BTW, on a separate bug, the parameters I'm passing must not include $schema and contentVersion. I think this was also a known problem and it was reported and fixed before. So, it seems the Microsoft.Azure.Management.Fluent 1.37.1 version might not have those fixes merged in correctly?

yaohaizh commented 3 years ago

@yungezz @weidongxu-microsoft

weidongxu-microsoft commented 3 years ago

@bwfilms

For the output, it seems the previous fix only fixed the sync method, but not the async method. New fix https://github.com/Azure/azure-libraries-for-net/pull/1230

For the $schema and contentVersion, SDK does not do any additional processing. It just send them to ARM.

bwfilms commented 3 years ago

@bwfilms

For the output, it seems the previous fix only fixed the sync method, but not the async method. New fix #1230

For the $schema and contentVersion, SDK does not do any additional processing. It just send them to ARM.

@weidongxu-microsoft, how do I go about getting an updated package with the fix? Thanks!

weidongxu-microsoft commented 3 years ago

@bwfilms

The fix is included in 1.37.1 release.

bwfilms commented 3 years ago

@bwfilms

The fix is included in 1.37.1 release.

@weidongxu-microsoft, in my original post, I found the problem still exists in 1.37.1. So, the package has been updated to include the fix, but kept the same version number? Sorry for the noob question as I'm not familiar with how to go about getting a package with the fix. Thanks!

weidongxu-microsoft commented 3 years ago

@bwfilms

Sorry, I misread the date. 1.37.1 is released on March, fix is on April. The fix is not included in any released package yet.

bwfilms commented 3 years ago

@weidongxu-microsoft

No problem. If I do want to use the fix now, what's the recommended way? Clone the source repo, build, and use the library directly? Thanks!

weidongxu-microsoft commented 3 years ago

@bwfilms

You can clone the project, and include the required ".csproject" in your project (similar to Fluent.Test.sln https://github.com/Azure/azure-libraries-for-net/blob/master/Fluent.Tests.sln)

bwfilms commented 3 years ago

@weidongxu-microsoft (or anyone else who might have info)

I'm running on Mac OS 10.15.7, .NET Core 5.0.21, and Microsoft.Azure.Management.Fluent 1.37.1. My project is a .NET Core console app, and I use VS Code on my MAC.

In VS Code, inside the folder bin/Debug/net5.0, I see the various DLLs from the Microsoft.Azure.Management.Fluent 1.37.1 NuGet package.

image

I'm building the latest source of Microsoft.Azure.Management.Fluent using VS on my PC. I see that it builds both net452 and netstandard1.4. The bin/Debug/net452 and bin/Debug/netstandard1.4 each does contain all of the DLLs available from the NuGet package.

I have 2 questions: 1) how do I build a net5.0 versions of these DLLs? There's no pre-configured build for net5.0 from the downloaded code. 2) are DLLs built on my PC consumable on my MAC? If not, how do I build these DLLs so that they can be used on my MAC?

Thanks!

weidongxu-microsoft commented 3 years ago

If you want to build specifically for net5.0, you can add net5.0 to csproj file.

  <PropertyGroup>
    <TargetFrameworks>net452;net461;netstandard1.4</TargetFrameworks>
  </PropertyGroup>

(however it might have unforeseeable issue).

I assume net5.0 would be backward compatible, so if you project target is net5.0, it just loads net452 or net461 DLLs (as currently we do not have specific net5.0 build). And I think .NET is compatible from PC and MAC.