Skip to content

Instantly share code, notes, and snippets.

@joewashington75
joewashington75 / apim-to-azure-service-bus-on-api-error.xml
Created July 13, 2021 15:17
APIM send message to Azure Service Bus when backend API is down
<policies>
<inbound>
<base />
<set-backend-service base-url="https://yourapihere.com" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<choose>
@joewashington75
joewashington75 / SeleniumAzureAdAuth.cs
Created February 22, 2022 13:21
Basic Authentication using Selenium
public static IWebDriver AzureAdRedirectWithAuthDetails(this IWebDriver driver, string userName, string password, string domainToReplace)
{
Thread.Sleep(TimeSpan.FromSeconds(5));
var newUrlWithUserCredentials = driver.Url.Replace(domainToReplace, $"{WebUtility.HtmlEncode(userName)}:{password}@{domainToReplace}");
driver.Navigate().GoToUrl(newUrlWithUserCredentials);
return driver;
}
@joewashington75
joewashington75 / PlaywrightAzureAdBasicAuth.cs
Created February 22, 2022 13:44
Basic Authentication automation using Playwright
using Cocona;
using Microsoft.Playwright;
using PlaywightAzureAdBasicAuth;
var builder = CoconaApp.CreateBuilder();
var app = builder.Build();
app.AddCommand(async ([Argument(Description = "Username to login with")] string userName,
[Argument(Description = "Password to login with")] string password,
[Argument(Description = "The url of your application as a starting point where your login button is located")] string applicationUrl,