Skip to content

Commit 2d1652f

Browse files
committed
Merge pull request #881 from ogail/psget
Rename Profile to DefaultProfile
2 parents 0a35d8c + 99e16b5 commit 2d1652f

File tree

64 files changed

+405
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+405
-405
lines changed

src/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static AzureRMCmdlet()
3535
/// <summary>
3636
/// Gets or sets the global profile for ARM cmdlets.
3737
/// </summary>
38-
public static AzureRMProfile Profile { get; set; }
38+
public static AzureRMProfile DefaultProfile { get; set; }
3939

4040
/// <summary>
4141
/// Gets the current default context.
@@ -44,12 +44,12 @@ protected override AzureContext DefaultContext
4444
{
4545
get
4646
{
47-
if (Profile == null || Profile.DefaultContext == null)
47+
if (DefaultProfile == null || DefaultProfile.DefaultContext == null)
4848
{
4949
throw new PSInvalidOperationException("Run Login-AzureRMAccount to logic with profile.");
5050
}
5151

52-
return Profile.DefaultContext;
52+
return DefaultProfile.DefaultContext;
5353
}
5454
}
5555
}

src/Common/Commands.ScenarioTests.Common/RMTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void BaseSetup()
5454
AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud],
5555
new AzureTenant { Id = Guid.NewGuid(), Domain = "testdomain.onmicrosoft.com" });
5656

57-
AzureRMCmdlet.Profile = currentProfile;
57+
AzureRMCmdlet.DefaultProfile = currentProfile;
5858

5959
// Now override AzureSession.DataStore to use the MemoryDataStore
6060
if (AzureSession.DataStore != null && !(AzureSession.DataStore is MemoryDataStore))

src/ResourceManager/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public IAutomationClient AutomationClient
4646
{
4747
get
4848
{
49-
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
49+
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
5050
}
5151

5252
set

src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public IAutomationClient AutomationClient
4040
{
4141
get
4242
{
43-
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
43+
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
4444
}
4545

4646
set

src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public IAutomationClient AutomationClient
4242
{
4343
get
4444
{
45-
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
45+
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
4646
}
4747

4848
set

src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public IAutomationClient AutomationClient
4141
{
4242
get
4343
{
44-
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
44+
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
4545
}
4646

4747
set

src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public IAutomationClient AutomationClient
4242
{
4343
get
4444
{
45-
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
45+
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
4646
}
4747

4848
set

src/ResourceManager/Compute/Commands.Compute/Common/ComputeClientBaseCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public ComputeClient ComputeClient
3131
{
3232
if (computeClient == null)
3333
{
34-
computeClient = new ComputeClient(Profile.DefaultContext)
34+
computeClient = new ComputeClient(DefaultProfile.DefaultContext)
3535
{
3636
VerboseLogger = WriteVerboseWithTimestamp,
3737
ErrorLogger = WriteErrorWithTimestamp

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected override void ProcessRecord()
186186
if (string.Equals(this.ParameterSetName, SetCustomScriptExtensionByContainerBlobsParamSetName))
187187
{
188188
this.StorageEndpointSuffix = string.IsNullOrEmpty(this.StorageEndpointSuffix) ?
189-
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix;
189+
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix;
190190
var sName = string.IsNullOrEmpty(this.StorageAccountName) ? GetStorageName() : this.StorageAccountName;
191191
var sKey = string.IsNullOrEmpty(this.StorageAccountKey) ? GetStorageKey(sName) : this.StorageAccountKey;
192192

@@ -234,7 +234,7 @@ protected override void ProcessRecord()
234234

235235
protected string GetStorageName()
236236
{
237-
return Profile.DefaultContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount);
237+
return DefaultProfile.DefaultContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount);
238238
}
239239

240240
protected string GetStorageKey(string storageName)

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/DscExtensionCmdletCommonBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private static IStorageManagementClient GetStorageClient(this Microsoft.Azure.Co
1717
{
1818
if (_storageClientWrapper == null)
1919
{
20-
_storageClientWrapper = new StorageManagementClientWrapper(AzureRMCmdlet.Profile.DefaultContext);
20+
_storageClientWrapper = new StorageManagementClientWrapper(AzureRMCmdlet.DefaultProfile.DefaultContext);
2121
}
2222

2323
return _storageClientWrapper.StorageManagementClient;

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/PublishAzureVMDscConfigurationCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected override void ProcessRecord()
179179
if (StorageEndpointSuffix == null)
180180
{
181181
StorageEndpointSuffix =
182-
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
182+
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
183183
}
184184
break;
185185
}

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ private void ValidateParameters()
262262
if (ArchiveStorageEndpointSuffix == null)
263263
{
264264
ArchiveStorageEndpointSuffix =
265-
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
265+
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
266266
}
267267

268268
if (!(Regex.Match(Version, VersionRegexExpr).Success))

src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/SetAzureVMDiagnosticsExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public StorageManagementClient StorageClient
161161
if (this.storageClient == null)
162162
{
163163
this.storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>(
164-
Profile.DefaultContext, AzureEnvironment.Endpoint.ServiceManagement);
164+
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ServiceManagement);
165165
}
166166

167167
return this.storageClient;

src/ResourceManager/Compute/Commands.Compute/RemoteDesktop/VirtualMachineRemoteDesktopBaseCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public NetworkClient NetworkClient
2727
{
2828
if (networkClient == null)
2929
{
30-
networkClient = new NetworkClient(Profile.DefaultContext)
30+
networkClient = new NetworkClient(DefaultProfile.DefaultContext)
3131
{
3232
VerboseLogger = WriteVerboseWithTimestamp,
3333
ErrorLogger = WriteErrorWithTimestamp,

src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ private StorageCredentialsFactory CreateStorageCredentialsFactory(BlobUri destin
152152
StorageCredentialsFactory storageCredentialsFactory;
153153

154154
var storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>(
155-
Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
155+
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
156156

157157
if (StorageCredentialsFactory.IsChannelRequired(Destination))
158158
{
159-
storageCredentialsFactory = new StorageCredentialsFactory(this.ResourceGroupName, storageClient, AzureRMCmdlet.Profile.DefaultContext.Subscription);
159+
storageCredentialsFactory = new StorageCredentialsFactory(this.ResourceGroupName, storageClient, AzureRMCmdlet.DefaultProfile.DefaultContext.Subscription);
160160
}
161161
else
162162
{

src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public IInsightsClient InsightsClient
4141
if (this.insightsClient == null)
4242
{
4343
// The premise is that a command to establish a context (like Add-AzureAccount) has been called before this command in order to have a correct CurrentContext
44-
this.insightsClient = AzureSession.ClientFactory.CreateClient<InsightsClient>(Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
44+
this.insightsClient = AzureSession.ClientFactory.CreateClient<InsightsClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
4545
}
4646

4747
return this.insightsClient;

src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public IInsightsManagementClient InsightsManagementClient
4040
if (this.insightsManagementClient == null)
4141
{
4242
// The premise is that a command to establish a context (like Add-AzureAccount) has been called before this command in order to have a correct CurrentContext
43-
this.insightsManagementClient = AzureSession.ClientFactory.CreateClient<InsightsManagementClient>(Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
43+
this.insightsManagementClient = AzureSession.ClientFactory.CreateClient<InsightsManagementClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
4444
}
4545

4646
return this.insightsManagementClient;

src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultEnvSetupHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public void SetupEnvironment()
4949
var testSubscription = new AzureSubscription()
5050
{
5151
Id = new Guid(csmEnvironment.SubscriptionId),
52-
Name = AzureRMCmdlet.Profile.DefaultContext.Subscription.Name,
53-
Environment = AzureRMCmdlet.Profile.DefaultContext.Environment.Name,
52+
Name = AzureRMCmdlet.DefaultProfile.DefaultContext.Subscription.Name,
53+
Environment = AzureRMCmdlet.DefaultProfile.DefaultContext.Environment.Name,
5454
Account = user,
5555
Properties = new Dictionary<AzureSubscription.Property, string>
5656
{
@@ -73,7 +73,7 @@ public void SetupEnvironment()
7373
}
7474
};
7575

76-
AzureRMCmdlet.Profile.DefaultContext = new AzureContext(testSubscription, testAccount, AzureRMCmdlet.Profile.DefaultContext.Environment, new AzureTenant { Id = new Guid(tenantId) });
76+
AzureRMCmdlet.DefaultProfile.DefaultContext = new AzureContext(testSubscription, testAccount, AzureRMCmdlet.DefaultProfile.DefaultContext.Environment, new AzureTenant { Id = new Guid(tenantId) });
7777
}
7878
}
7979

src/ResourceManager/KeyVault/Commands.KeyVault.Test/ScenarioTests/KeyVaultManagementController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ private GraphRbacManagementClient GetGraphClient()
194194
if (HttpMockServer.Variables.ContainsKey(TenantIdKey))
195195
{
196196
tenantId = HttpMockServer.Variables[TenantIdKey];
197-
AzureRMCmdlet.Profile.DefaultContext.Tenant.Id = new Guid(tenantId);
197+
AzureRMCmdlet.DefaultProfile.DefaultContext.Tenant.Id = new Guid(tenantId);
198198
}
199199
if (HttpMockServer.Variables.ContainsKey(DomainKey))
200200
{
201201
UserDomain = HttpMockServer.Variables[DomainKey];
202-
AzureRMCmdlet.Profile.DefaultContext.Tenant.Domain = UserDomain;
202+
AzureRMCmdlet.DefaultProfile.DefaultContext.Tenant.Domain = UserDomain;
203203
}
204204

205205
}

0 commit comments

Comments
 (0)