RESOLVED: CORS issue on ionic Mobile App ios

Problem:   I was working on a project in which I was developing an ionic application which needed to access a Website URL hosted on Azure App Service. The app was unable to connect and was throwing CORS issue. When I debugged using xcode, I found that the request is being made by the url capacitor://localhost and when I tried adding the same in Azure App Service, this was not allowed: After doing some research, I found the solution here: Solution: I used azure cli to add the cors url. For this: In case, you are not having azure cli, download it here: Run command: az login Run the following command to add url:  az webapp cors add --allowed-origins capacitor://localhost --name MyAppService --resource-group MyResourceGroup Happy Coding.

Resolved Error - Azure Powershell failed to get token from Token Cache. Getting You cannot call a method on a null-valued expression

 Recently, I was working on an Azure Powershell Script in which I was getting the Cached Token and it was working fine for a long time and it started failing recently.

Here is the code that I was using in my powershell script:

    Write-Host "Getting Az Context"
    $azContext = Get-AzContext
    Write-Host "Displaying context"

    #$rmAccount = Add-AzureRmAccount -SubscriptionId $subscriptionId 
    #$tenantId = $azureRmContext.Tenant.Id
    $tokenCache = $azContext.TokenCache
    $cachedTokens = $tokenCache.ReadItems() `
        #| where { $_.TenantId -eq $tenantId } `
        Sort-Object -Property ExpiresOn -Descending

Now, I started getting the error "You cannot call a method on a null-valued expression". I was clear that my Token Cache is getting expired and then I googled about the issue and I find the following useful github links: And finally, I implemented the following solution:


    $currentAzureContext = Get-AzContext
    $azureRmProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile;
    $profileClient = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient($azureRmProfile);