Assign Resource Account to CallQueue or AutoAttendant (Powershell)


Hi Everyone,


i have created a provisioning Script for the creation of the resource accounts / callqueue / autoattendant but the final steps 7&8 (assign resource account) is missing. I have found informations how to assign them in teams admin center (GUI) but not via powershell. Does someone know how to assign the RA to the CQ or a AA via powershell ?


Scripting Plan:

  1. Create Resource Accounts (CallQueue / AutoAttendant)
  2. Set Usage Location to Resource Accounts
  3. Assign PhoneSystem Virtual User License to Resource Accounts
  4. Assign TelephoneNumber to Resource Account (AutoAttendant)
  5. Create CallQueue
  6. Create AutoAttendant (Redirect Call to Call Queue)
  7. Assign Resource Account (Call Queue) to Call Queue
  8. Assign Resource Account (AutoAttendant) to AutoAttendant
8 Replies

No Not Yet . ressource account creation is a nightmare !!!



I'm not sure the previous response to this is valid.  The commands you're looking for are *-CsOnlineApplicationInstanceAssociation. Based on documentation, the command New-CsOnlineApplicationInstanceAssociation has been around since at least December 2018.


Basic usage would look like this:


$ResourceAccountId = (Get-CsOnlineUser "").ObjectId
$AutoAttendant = (Get-CsAutoAttendant -NameFilter "Main Auto Attendant").Identity

New-CsOnlineApplicationInstanceAssociation -Identities @($ResourceAccountId) -ConfigurationId $AutoAttendant -ConfigurationType AutoAttendant


Same for Call Queues except using Get-CsCallQueue and changing the ConfigurationType to CallQueue.

Worked great. I'm used to using the GUI but this is a much faster method and used when Microsoft was rolling back an update.

Hello, I would be happy if anyone can share an opinion or provide a certain answer on the question below.
If we need to follow Microsoft’s guide, there will be a major outage with all call queues and auto attendants before we migrate and assign resource accounts created in the cloud on all of them. Creating resource accounts in Azure can happen only when you decommission Skype for Business Hybrid, it SIMPLY DOES NOT WORK BEFORE THAT. QUESTION IS : If we do not do this and decide NOT to create resource accounts in the cloud, are the call queues and auto attendants going to work when we decommission Skype for Business and is the only problem going to be the fact that we won’t be able to manage them with PowerShell but only using AD attributes?



I'm on the same situation here (skype hybrid decom)


you have two options:

1.Major outage (as first you need to point DNS to MS, not your onprem, so you break your hybrid res accnt) and only then you can create pureonlineinstance with your current domain

2. (my aproach) create res accnts with online tenant


no other options



Apparently, Microsoft magically provided the ability to create resource accounts directly Online using the New-CsOnlineApplicationInstance cmdlet BEFORE REMOVING THE HYBRID. The option to create the resource accounts was still not working from the Admin Center. I have shown this to couple of guys from Microsoft's support one of them being UC specialist from the Fast Track team and they were extremely surprised it works. We have decommissioned Skype today, 2 weeks after creating the accounts and running the services in Hybrid mode with both Direct Routing on-prem numbers and Calling Plans:)

We have created all 150 accounts and have assigned licenses, usage locations and numbers using this:


$data = Import-Csv "C:\Users\........Production.csv" -Delimiter "`t"
$Credential = Get-Credential
Connect-AzureAD -Credential $Credential
Connect-MicrosoftTeams -TenantId "TennantID" -Credential $Credential

foreach ($item in $data) {
# Collects values to set
$UPN = $item.UPN
$displayName = $item.DisplayName
$Phone = $item.PhoneNumber
$Country = $item.Country
if ($item.Type -ne "AA") {
$AppId = "11cd3e2e-fccb-42ad-ad00-878b93575e07" # CQ
} else {
$AppId = "ce933385-9390-45d1-9512-c8d228074e07" # AA

# Creates the ApplicationInstance object
$Object = New-CsOnlineApplicationInstance -UserPrincipalName $UPN -ApplicationId $AppId -DisplayName $displayName

# Waits for the user to exist
while ((Get-AzureADUser -ObjectId $UPN -ErrorAction SilentlyContinue) -eq $null) { sleep 50 }

# Assigns Usage Location
Set-AzureADUser -ObjectId $UPN -UsageLocation $Country

# Assigns the license
$License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
$License.SkuId = (Get-AzureADSubscribedSku |where {$_.skuPartNumber -eq "PHONESYSTEM_VIRTUALUSER" }).SkuId
$Licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
$Licenses.AddLicenses = $License
Set-AzureADUserLicense -ObjectId $UPN -AssignedLicenses $Licenses

# Waits for the license to be assigned
while (((Get-AzureADUser -ObjectId $UPN).AssignedPlans | where {($_.Service -eq "MicrosoftCommunicationsOnline") -and ($_.CapabilityStatus -eq "Enabled")}) -eq $null) {
write-host (get-date)
sleep 1

## Sets the phone number to the ApplicationInstance
#Set-CsOnlineApplicationInstance -Identity $Object.ObjectId -OnpremPhoneNumber $Phone



hey Ivan,
this command is quite old, and my understanding is:

unless dns doesn't point to
you cant create pureonline accnts Email address removed, you can create only Email address removed

so when did you made DNS change? before or after creating pureonline accnts?


Hello, DNS changes have been made 3 weeks after creating the accounts and the AA and CQ were working during that time with the new cloud resource accounts. Skype for Business server was decommissioned by NOT following the Microsoft guide, as if we have followed it, there would have been a serious outage. 5 tickets raised with Microsoft, 1 Fast Track and nobody knew why it was working :) It still works now, so there is no problem at all.