Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reference for Azure.Identity #19434

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<ItemGroup>
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.ResourceManager.Resources" />
<PackageReference Include="System.Linq.Async" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using Azure.Core;
using Azure.Identity;
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down Expand Up @@ -37,16 +36,6 @@ protected AzureResourceManagerClient()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class
/// with <see cref="DefaultAzureCredential"/> as credential.
/// </summary>
/// <param name="options"> The client parameters to use in these operations. </param>
public AzureResourceManagerClient(AzureResourceManagerClientOptions options = default)
: this(null, null, new DefaultAzureCredential(), options)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion sdk/resourcemanager/Proto.Client/src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Azure.ResourceManager.Core;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ static void Main(string[] args)
foreach (var rgId in Scenario.CleanUp)
{
ResourceIdentifier id = new ResourceIdentifier(rgId);
var rg = new AzureResourceManagerClient().GetSubscriptionOperations(id.Subscription).GetResourceGroupOperations(id.ResourceGroup);
var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(id.Subscription).GetResourceGroupOperations(id.ResourceGroup);
Console.WriteLine($"--------Deleting {rg.Id.Name}--------");
try
{
Expand Down
4 changes: 4 additions & 0 deletions sdk/resourcemanager/Proto.Client/src/Proto.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
<NoWarn>$(NoWarn);AZC0001;CA1303</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.2.3"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Azure.ResourceManager.Core;
using Proto.Compute;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -11,7 +12,7 @@ public override void Execute()
var createVm = new CreateSingleVmExample(Context);
createVm.Execute();

var rgOp = new AzureResourceManagerClient().GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
foreach (var genericOp in rgOp.GetVirtualMachineContainer().ListAsGenericResource(Context.VmName))
{
Console.WriteLine($"Adding tag to {genericOp.Id}");
Expand Down
3 changes: 2 additions & 1 deletion sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -28,7 +29,7 @@ public override void Execute()
foreach (var rgId in CleanUp)
{
ResourceIdentifier id = new ResourceIdentifier(rgId);
var rg = new AzureResourceManagerClient().GetResourceGroupOperations(rgId);
var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(rgId);
Console.WriteLine($"--------Deleting {rg.Id.Name}--------");
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using Azure.ResourceManager.Core;
using Proto.Compute;
using System;
using Azure.Identity;

namespace Proto.Client
{
class CheckResourceExists : Scenario
{
public override void Execute()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subOp = client.DefaultSubscription;
var rgContainer = subOp.GetResourceGroupContainer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Proto.Compute;
using System;
using System.Threading.Tasks;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ public override void Execute()

private async System.Threading.Tasks.Task ExecuteAsync()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Proto.Compute;
using System;
using System.Threading.Tasks;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ public override void Execute()

private async System.Threading.Tasks.Task ExecuteAsync()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Azure.Core.Pipeline;
using System.Threading;
using System.Diagnostics;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,8 +19,8 @@ public override void Execute()
var dummyPolicy2 = new dummyPolicy2();
options1.AddPolicy(dummyPolicy1, HttpPipelinePosition.PerCall);
options2.AddPolicy(dummyPolicy2, HttpPipelinePosition.PerCall);
var client1 = new AzureResourceManagerClient(options1);
var client2 = new AzureResourceManagerClient(options2);
var client1 = new AzureResourceManagerClient(new DefaultAzureCredential(), options1);
var client2 = new AzureResourceManagerClient(new DefaultAzureCredential(), options2);

Console.WriteLine("-----Client 1-----");
foreach (var sub in client1.GetSubscriptionContainer().List())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Proto.Network;
using System;
using System.Collections.Generic;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -14,7 +15,7 @@ public CreateMultipleVms(ScenarioContext context) : base(context) { }

public override void Execute()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Proto.Network;
using System;
using System.Linq;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -14,7 +15,7 @@ public CreateSingleVMCheckLocation(ScenarioContext context) : base(context) { }

public override void Execute()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Proto.Compute;
using Proto.Network;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -13,7 +14,7 @@ public CreateSingleVmExample(ScenarioContext context) : base(context) { }

public override void Execute()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Proto.Compute;
using Proto.Network;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ public override void Execute()

private async System.Threading.Tasks.Task ExcuteAsync()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void Execute()

Console.WriteLine("Found correct subscription");

client = new AzureResourceManagerClient();
client = new AzureResourceManagerClient(new DefaultAzureCredential());

sub = client.DefaultSubscription;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Azure.ResourceManager.Core;
using Proto.Compute;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -12,7 +13,7 @@ public override void Execute()
var createVm = new CreateSingleVmExample(Context);
createVm.Execute();

var rgOp = new AzureResourceManagerClient().GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
foreach(var genericOp in rgOp.GetVirtualMachineContainer().ListAsGenericResource(Context.VmName))
{
Console.WriteLine($"Deleting {genericOp.Id}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Proto.Compute;
using Azure.ResourceManager.Core;
using System;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -11,7 +12,7 @@ public override void Execute()
var createVm = new CreateSingleVmExample(Context);
createVm.Execute();

var rgOp = new AzureResourceManagerClient().GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName);
foreach(var entity in rgOp.GetVirtualMachineContainer().List())
{
Console.WriteLine($"{entity.Id.Name}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ private async Task ExecuteAsync()
var createMultipleVms = new CreateMultipleVms(Context);
createMultipleVms.Execute();

var sub = new AzureResourceManagerClient().GetSubscriptionOperations(Context.SubscriptionId);
var sub = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId);
var rg = sub.GetResourceGroupOperations(Context.RgName);
var virtualMachineContainer = rg.GetVirtualMachineContainer();
await foreach (var response in virtualMachineContainer.ListAsync())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Proto.Network;
using System;
using System.Diagnostics;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -13,7 +14,7 @@ public override void Execute()
var createMultipleVms = new CreateMultipleVms(Context);
createMultipleVms.Execute();

var sub = new AzureResourceManagerClient().GetSubscriptionOperations(Context.SubscriptionId);
var sub = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId);
var rg = sub.GetResourceGroupOperations(Context.RgName);
var virtualMachineContainer = rg.GetVirtualMachineContainer();
foreach (var response in virtualMachineContainer.List())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Azure.ResourceManager.Core;
using Azure.Identity;
using Azure.ResourceManager.Core;
using Proto.Compute;
using Proto.Network;

Expand All @@ -11,7 +12,7 @@ public override void Execute()
var createVm = new CreateSingleVmExample(Context);
createVm.Execute();

var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

var resourceGroup = subscription.GetResourceGroupOperations(Context.RgName).Get().Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Azure.ResourceManager.Core;
using System;
using System.Diagnostics;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -10,7 +11,7 @@ public override void Execute()
{
var sandboxId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c";
var expectDisplayName = "Azure SDK sandbox";
var subOp = new AzureResourceManagerClient().GetSubscriptionOperations(sandboxId);
var subOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(sandboxId);
var result = subOp.Get();
Debug.Assert(expectDisplayName == result.Value.Data.DisplayName);
Console.WriteLine("Passed, got " + result.Value.Data.DisplayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Proto.Network;
using System;
using System.Linq;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -18,7 +19,7 @@ public override void Execute()
var createVm = new CreateSingleVmExample(Context);
createVm.Execute();

var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);
var resourceGroup = subscription.GetResourceGroupOperations(Context.RgName);
var vmId = resourceGroup.GetVirtualMachineOperations(Context.VmName).Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Proto.Network;
using System;
using System.Threading.Tasks;
using Azure.Identity;

namespace Proto.Client
{
Expand All @@ -13,7 +14,7 @@ public override void Execute()
var createMultipleVms = new CreateMultipleVms(Context);
createMultipleVms.Execute();

var rg = new AzureResourceManagerClient().GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value;
var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value;
foreach (var availabilitySet in rg.GetAvailabilitySetContainer().ListAsGenericResource(Environment.UserName))
{
Console.WriteLine($"--------AvailabilitySet operation id--------: {availabilitySet.Id}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
using Proto.Compute;
using Proto.Network;
using System;
using Azure.Identity;

namespace Proto.Client
{
class RoleAssignment : Scenario
{
public override void Execute()
{
var client = new AzureResourceManagerClient();
var client = new AzureResourceManagerClient(new DefaultAzureCredential());
var subscription = client.GetSubscriptionOperations(Context.SubscriptionId);

// Create Resource Group
Expand Down
Loading