fix possible NPE and tests for AzureProvider