public virtual DeviceUpdateAccountUpdateOperation Update(bool waitForCompletion, DeviceUpdateAccountUpdateOptions accountUpdatePayload, CancellationToken cancellationToken = default) { if (accountUpdatePayload == null) { throw new ArgumentNullException(nameof(accountUpdatePayload)); } using var scope = _deviceUpdateAccountAccountsClientDiagnostics.CreateScope("DeviceUpdateAccount.Update"); scope.Start(); try { var response = _deviceUpdateAccountAccountsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accountUpdatePayload, cancellationToken); var operation = new DeviceUpdateAccountUpdateOperation(ArmClient, _deviceUpdateAccountAccountsClientDiagnostics, Pipeline, _deviceUpdateAccountAccountsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accountUpdatePayload).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task UpdateAccounts() { #region Snippet:Managing_Accounts_UpdateAnAccount // First we need to get the account collection from the specific resource group DeviceUpdateAccountCollection accountCollection = resourceGroup.GetDeviceUpdateAccounts(); // Now we can get the account with GetAsync() DeviceUpdateAccount account = await accountCollection.GetAsync("myAccount"); // With UpdateAsync(), we can update the account DeviceUpdateAccountUpdateOptions updateOptions = new DeviceUpdateAccountUpdateOptions() { Location = AzureLocation.WestUS2, Identity = new ManagedServiceIdentity(ResourceManager.Models.ManagedServiceIdentityType.None) }; DeviceUpdateAccountUpdateOperation lro = await account.UpdateAsync(true, updateOptions); account = lro.Value; #endregion Snippet:Managing_Accounts_UpdateAnAccount }