/// <summary> /// Regenerate a primary or secondary agent registration key (see /// http://aka.ms/azureautomationsdk/agentregistrationoperations for /// more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Automation.IAgentRegistrationOperation. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group /// </param> /// <param name='automationAccount'> /// Required. The automation account name. /// </param> /// <param name='keyName'> /// Required. The name of the agent registration key to be regenerated /// </param> /// <returns> /// The response model for the agent registration key regenerate /// operation. /// </returns> public static Task<AgentRegistrationRegenerateKeyResponse> RegenerateKeyAsync(this IAgentRegistrationOperation operations, string resourceGroupName, string automationAccount, AgentRegistrationRegenerateKeyParameter keyName) { return operations.RegenerateKeyAsync(resourceGroupName, automationAccount, keyName, CancellationToken.None); }
public Model.AgentRegistration NewAgentRegistrationKey( string resourceGroupName, string automationAccountName, string keyType) { using (var request = new RequestSettings(this.automationManagementClient)) { Requires.Argument("ResourceGroupName", resourceGroupName).NotNull(); Requires.Argument("AutomationAccountName", automationAccountName).NotNull(); Requires.Argument("KeyType", keyType).NotNull(); AgentRegistrationRegenerateKeyParameter keyName = new AgentRegistrationRegenerateKeyParameter() { KeyName = keyType }; var agentRegistration = this.automationManagementClient.AgentRegistrationInformation.RegenerateKey( resourceGroupName, automationAccountName, keyName).AgentRegistration; return new Model.AgentRegistration(resourceGroupName, automationAccountName, agentRegistration); } }
/// <summary> /// Regenerate a primary or secondary agent registration key (see /// http://aka.ms/azureautomationsdk/agentregistrationoperations for /// more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Automation.IAgentRegistrationOperation. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group /// </param> /// <param name='automationAccount'> /// Required. The automation account name. /// </param> /// <param name='keyName'> /// Required. The name of the agent registration key to be regenerated /// </param> /// <returns> /// The response model for the agent registration key regenerate /// operation. /// </returns> public static AgentRegistrationRegenerateKeyResponse RegenerateKey(this IAgentRegistrationOperation operations, string resourceGroupName, string automationAccount, AgentRegistrationRegenerateKeyParameter keyName) { return Task.Factory.StartNew((object s) => { return ((IAgentRegistrationOperation)s).RegenerateKeyAsync(resourceGroupName, automationAccount, keyName); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }