Is there something happening with your licenses in the background? Being synchronized from another (ERP) system that over rule your settings?
If licenses get removed from the user, the enterpricevoice functionality is being removed automatically.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Below is a simplified version of a script that I wrote that provisions 2 existing users for Enterprise Voice in teams with a calling plan (I have made minor changes to the script to hide confidential data).
The existing users already have an E1 license.
Sometimes the script works as expected, however most times I get an initial success, but when I look at the users a few minutes later, the EV settings have disappeared on 1 or both users.
I can find no consistency to predict the user that will lose its settings.
When I run a similar script for users that I am provisioning for Direct Route (i.e. they have no Calling Plan license), it runs consistently every time.
What am I doing incorrectly?
$skuIdPSTN = Get-AzureADSubscribedSku | Where-Object {$_.SkuPartNumber -eq 'MCOPSTN1'} | select SkuId
$skuIdMCOEV = Get-AzureADSubscribedSku | Where-Object {$_.SkuPartNumber -eq 'MCOEV'} | select SkuId
$AssignedLicenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
$LicenseMCOEV = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
$LicenseMCOEV.SkuId = $skuIdMCOEV.SkuId
$LicensePSTN = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
$LicensePSTN.SkuId = $skuIdPSTN.SkuId
$AssignedLicenses.AddLicenses = @($LicenseMCOEV, $LicensePSTN)
$AssignedLicenses.RemoveLicenses = @()
Set-AzureADUserLicense -ObjectId ******@contoso.com -AssignedLicenses $AssignedLicenses
Set-AzureADUserLicense -ObjectId ******@contoso.com -AssignedLicenses $AssignedLicenses
Start-Sleep -s 20
$cnt1 = 0
$sleep = 5
Set-CsOnlineVoiceUser -Identity "******@contoso.com" -TelephoneNumber +12122069936 -LocationID 726a2e5a-4f2d-4d91-a1d7-285c5be27d4c
$phoneNumber = Get-CsOnlineVoiceUser -Identity "******@contoso.com" | select Number, EnterpriseVoiceEnabled
while (($phoneNumber.Number -eq $null -or $phoneNumber.Number.Length -eq 0 -or $phoneNumber.EnterpriseVoiceEnabled -eq $false) -and $cnt1 -lt 20)
{
Start-Sleep -s $sleep
Set-CsOnlineVoiceUser -Identity "******@contoso.com" -TelephoneNumber +12122069936 -LocationID 726a2e5a-4f2d-4d91-a1d7-285c5be27d4c
$phoneNumber = Get-CsOnlineVoiceUser -Identity "******@contoso.com" | select Number, EnterpriseVoiceEnabled
$cnt1++
Write-Output "Set Number" + $cnt1
}
Write-Output "Alice Number Provisioned"
Grant-CsTeamsCallingPolicy -Identity "******@contoso.com" -PolicyName "AllowCalling"
Grant-CsTenantDialPlan -Identity "******@contoso.com" -PolicyName "MyDialPlan"
Write-Output "Alice Policies Provisioned"
$cnt1 = 0
Set-CsOnlineVoiceUser -Identity "******@contoso.com" -TelephoneNumber +12123382978 -LocationID 726a2e5a-4f2d-4d91-a1d7-285c5be27d4c
$phoneNumber = Get-CsOnlineVoiceUser -Identity "******@contoso.com" | select Number, EnterpriseVoiceEnabled
$sleep += $sleep
while (($phoneNumber.Number -eq $null -or $phoneNumber.Number.Length -eq 0 -or $phoneNumber.EnterpriseVoiceEnabled -eq $false) -and $cnt1 -lt 20)
{
Start-Sleep -s $sleep
Set-CsOnlineVoiceUser -Identity "******@contoso.com" -TelephoneNumber +12123382978 -LocationID 726a2e5a-4f2d-4d91-a1d7-285c5be27d4c
$phoneNumber = Get-CsOnlineVoiceUser -Identity "******@contoso.com" | select Number, EnterpriseVoiceEnabled
$cnt1++
Write-Output "Set Number" + $cnt1
}
Write-Output "Bob Number Provisioned"
Grant-CsTeamsCallingPolicy -Identity "******@contoso.com" -PolicyName "AllowCalling"
Grant-CsTenantDialPlan -Identity "bob@contos
Additional features, settings, or issues not covered by specific Microsoft Teams categories
Is there something happening with your licenses in the background? Being synchronized from another (ERP) system that over rule your settings?
If licenses get removed from the user, the enterpricevoice functionality is being removed automatically.