open Microsoft.Azure.Management.ResourceManager.Fluent open Microsoft.Azure.Management.Fluent let ClientId = "" let ServicePrincipalPassword = "" let AzureTenantId = "" let AzureSubscriptionId = "" let azureCredentials = let servicePrincipalLoginInformation = Authentication.ServicePrincipalLoginInformation() servicePrincipalLoginInformation.ClientId <- ClientId servicePrincipalLoginInformation.ClientSecret <- ServicePrincipalPassword Authentication.AzureCredentials(servicePrincipalLoginInformation, AzureTenantId, AzureEnvironment.AzureGlobalCloud) let azure = Azure.Configure().Authenticate(azureCredentials).WithSubscription(AzureSubscriptionId) let resourceGroups = azure.ResourceGroups.List() resourceGroups |> Seq.iter (fun x -> printfn "%s" x.Name)