你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
AzureRmProfile.TrySetContext Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TrySetContext(IAzureContext, String) | |
TrySetContext(String, IAzureContext) |
Add the input context with the specified name. If the context with the same tenant, subscription, accountId does not exist, add the input into context list. If the context with the same tenant, subscription, accountId already exist, merge 2 contexes and add the merged context to the context list. |
TrySetContext(IAzureContext, String)
public bool TrySetContext (Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext context, out string name);
abstract member TrySetContext : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext * string -> bool
override this.TrySetContext : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext * string -> bool
Public Function TrySetContext (context As IAzureContext, ByRef name As String) As Boolean
Parameters
- context
- IAzureContext
- name
- String
Returns
Implements
Applies to
TrySetContext(String, IAzureContext)
Add the input context with the specified name. If the context with the same tenant, subscription, accountId does not exist, add the input into context list. If the context with the same tenant, subscription, accountId already exist, merge 2 contexes and add the merged context to the context list.
public bool TrySetContext (string name, Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext context);
abstract member TrySetContext : string * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext -> bool
override this.TrySetContext : string * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext -> bool
Public Function TrySetContext (name As String, context As IAzureContext) As Boolean
Parameters
- name
- String
The specified new name of the context.
- context
- IAzureContext
The new context to set as default.