Development edition · 16 November 2026. Commands using repository paths, Make targets or sample projects require access to the Quinzee source checkout. No public installer is available. Examples use disposable local environments.
4. Sign in and create a resource group
An application signs in using a tenant ID, client ID and client
secret. Quinzee creates a development tenant, subscription and application
identity on first startup. The application environment supplies these values to
the private tutorial settings created in chapter 3. No real Azure subscription
or az login is involved.
ClientSecretCredential requests tokens from login.microsoftonline.com.
ArmClient uses the token for management.azure.com. Your container's DNS and
CA setup make both requests local while retaining HTTPS verification.
Step 1: create the shared context
Save the following as BookContext.cs in .local/book/project using your
host editor. Keep it for all subsequent examples. It reads private configuration,
constructs the ordinary Azure clients and supplies a small helper for ARM
operations that the examples call directly.
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using System.Net.Http.Headers;
using System.Text.Json;
public sealed record BookSettings(
string TenantId, string ClientId, string ClientSecret,
string SubscriptionId, string Prefix, string Group, string DatabasePassword);
public sealed class BookContext
{
public BookSettings Settings { get; }
public TokenCredential Credential { get; }
public ArmClient Arm { get; }
public string GroupId =>
$"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.Group}";
private BookContext(BookSettings settings)
{
Settings = settings;
Credential = new ClientSecretCredential(
settings.TenantId, settings.ClientId, settings.ClientSecret);
Arm = new ArmClient(Credential, settings.SubscriptionId);
}
public static BookContext Load()
{
var settings = JsonSerializer.Deserialize<BookSettings>(
File.ReadAllText("/run/book/settings.json"),
new JsonSerializerOptions { PropertyNameCaseInsensitive = true })
?? throw new InvalidOperationException("Missing tutorial settings");
return new BookContext(settings);
}
public Dictionary<string, string> Outputs() =>
JsonSerializer.Deserialize<Dictionary<string, string>>(
File.ReadAllText("outputs.json"))
?? throw new InvalidOperationException("Run the deployment chapter first");
public async Task<JsonDocument> PostArmAsync(string providerPath, string version)
{
var token = await Credential.GetTokenAsync(
new TokenRequestContext(["https://management.azure.com/.default"]),
CancellationToken.None);
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
using var request = new HttpRequestMessage(HttpMethod.Post,
$"https://management.azure.com{GroupId}/providers/{providerPath}?api-version={version}");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token.Token);
using var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();
return JsonDocument.Parse(await response.Content.ReadAsStringAsync());
}
}
The client secret is never printed. The settings mount is read-only, and only
this development container needs to read it. BookContext is example application
code, not a Quinzee-specific SDK dependency.
Step 2: create the group
Save this as Program.cs, next to BookContext.cs:
using Azure;
using Azure.Core;
using Azure.ResourceManager.Resources;
var book = BookContext.Load();
var subscription = book.Arm.GetSubscriptionResource(
new ResourceIdentifier($"/subscriptions/{book.Settings.SubscriptionId}"));
var operation = await subscription.GetResourceGroups().CreateOrUpdateAsync(
WaitUntil.Completed,
book.Settings.Group,
new ResourceGroupData(AzureLocation.WestEurope));
Console.WriteLine($"Ready: {operation.Value.Data.Name}");
await foreach (var group in subscription.GetResourceGroups().GetAllAsync())
Console.WriteLine($"{group.Data.Name}: {group.Data.Location}");
In the client container, run dotnet run --no-restore. Expect a group named
quinzee-book-bk…. Creating it again updates the same group. Other groups listed
belong to other local exercises; do not delete them as part of this tutorial.
WestEurope is resource metadata here. Choosing it does not contact Azure or
select a remote machine. The emulator uses the configured local services.
Understand authentication errors
The browser access token, an Azure bearer token and a client secret serve
different purposes. Only the client secret belongs in ClientSecretCredential.
The SDK gets different bearer tokens for ARM, Storage, Key Vault and monitoring;
an ARM token cannot be substituted for a monitoring query token.
Tokens expire after an hour and the cloud's signing key changes on restart.
Create a fresh credential/client after restarting the cloud if a cached token
keeps receiving 401. Each dotnet run here starts a new process. An
invalid_client error usually means the settings came from a different local
environment.
This tutorial uses the generated bootstrap application, which retains broad local privileges. New applications and users start without permissions. Quinzee also supports service-principal management, Functions managed identities, scoped ARM/Service Bus roles and local browser login with PKCE. See application identities and user sign-in for the separate examples and their compatibility limits.