automation workflow - powershell script

Hi Team

I have a VA that i am using on the Web Interface. I have a PGV assigned to that VA and accepted values are 2GB, 5GB, 10GB, 15GB , 20GB , 25GB and 30GB

I have setup a Workflow so that when the VA is changed from say 2GB to 5GB that the script reads that change and then sets the value on the OneDrive account. If i run the script manually using something like this for obtaining the username then everything is good and the script executes fine. 

param

(
$UserName = (Read-Host -Prompt 'Enter UserName')
)

In ARS if i use the onPostModify then i am not sure if the script is firing. its 100% not making any changes to the OneDrive account. 

function onPostModify($Request)
{
Connect-QADService -Service "ARS-SERVERNAME" -Proxy

$AzureLocation = get-qaduser $Request -IncludedProperties 'msDS-preferredDataLocation' | Select-Object msDS-preferredDataLocation -ExpandProperty msDS-preferredDataLocation
$OneDriveSize = get-qaduser $Request -IncludedProperties 'OneDrive-Size' | Select-Object OneDrive-Size -ExpandProperty OneDrive-Size
$eMailAddress = get-qaduser $Request | Select-Object mail -ExpandProperty mail

#Location Switch

switch ($AzureLocation) {
    'Site1' { $SPURL = 'https://domain-name-here-admin.sharepoint.com' }
    default   { $SPURL = "https://domain-name-here$AzureLocation-admin.sharepoint.com"}
}

switch ($OneDriveSize) {
    '2GB' { $OneDriveQuota = '2147483648' }
    '2GB' { $OneDriveQuotaWarning = '1610612736' }
    '5GB' { $OneDriveQuota = '5368709120' }
    '5GB' { $OneDriveQuotaWarning = '4831838208' }
    '10GB' { $OneDriveQuota = '10737418240' }
    '10GB' { $OneDriveQuotaWarning = '10200547328' }
    '15GB' { $OneDriveQuota = '16106127360' }
    '15GB' { $OneDriveQuotaWarning = '15569256448' }
    '20GB' { $OneDriveQuota = '21474836480' }
    '20GB' { $OneDriveQuotaWarning = '20937965568' }
    '25GB' { $OneDriveQuota = '26843545600' }
    '25GB' { $OneDriveQuotaWarning = '26306674688' }
    '30GB' { $OneDriveQuota = '32212254720' }
    '30GB' { $OneDriveQuotaWarning = '31675383808' }
}

#Share Point Connection Properties
    $CxParams = @{
    URL = $SPURL
    ClientID = "ID-Here"
    Tenant = "domain-name-here.onmicrosoft.com"
    Thumbprint = "thumbprint-here"
}

#Connect to SharePoint Online
Connect-PnPOnline @CxParams

Set-PnPUserOneDriveQuota -Account $emailAddress -Quota $OneDriveQuota -QuotaWarning $OneDriveQuotaWarning


}