Modern cloud applications rarely depend on a single Azure resource. A production application may use Azure App Service, Azure SQL Database, Azure Storage, Key Vault, virtual networks, and several other services.
These resources work together, but Azure resource organization does not always describe how they depend on one another.
For example, an application may depend on a database, while the database depends on a private network connection. If the network becomes unavailable, the application may also experience failures.
Finding these connections manually can be difficult, especially when resources are distributed across multiple subscriptions and resource groups.
Azure Resource Manager Relationships addresses this problem by allowing developers to create and manage semantic relationships between Azure resources.
Microsoft provides the Azure.ResourceManager.Relationships library for .NET to manage these relationships programmatically. It supports dependency relationships and service group membership, helping organizations build a connected view of their cloud infrastructure.
In this article, we will understand Azure resource relationships, explore the Relationships .NET SDK, configure authentication, examine dependency relationships, work with service groups, and build a practical resource-dependency tracking workflow.
1. What Are Azure Resource Relationships?
Azure Resource Relationships are resource types that represent connections between Azure resources.
A relationship describes how one resource is associated with another resource.
For example, consider an application architecture:
Customer Portal
|
v
Azure App Service
|
v
Azure SQL Database
|
v
Azure Storage
The resources are separate Azure objects, but they work together to provide one application.
Azure Resource Relationships allows developers to represent these connections explicitly.
Instead of maintaining dependency information only in documentation or application configuration, organizations can store relationships as Azure resources.
A relationship can contain information about:
This information can help monitoring and governance systems understand how different resources are connected.
Why Are Resource Relationships Important?
Consider an enterprise application with 200 Azure resources distributed across multiple resource groups.
If one database becomes unavailable, the operations team needs to identify which applications depend on it.
Without a dependency map, engineers may need to inspect deployment files, application configuration, architecture documents, and resource settings.
With explicit relationships, the organization can maintain a connected representation of its infrastructure.
This is useful for:
Dependency mapping.
Service health investigation.
Outage root-cause analysis.
Change management.
Security and compliance reporting.
Infrastructure governance.
Azure Resource Relationships provides a foundation for these scenarios. It does not automatically discover every application dependency; organizations must create or maintain the relationships using supported mechanisms.
2. Understand the Azure Relationships Resource Provider
Azure manages resource relationships through the Microsoft.Relationships resource provider.
The provider exposes relationship resource types that can be managed through Azure Resource Manager.
Two important relationship types are:
DependencyOf
DependencyOf represents a dependency relationship between two resources.
It is useful when one Azure resource depends on another.
For example:
Customer API
|
| DependencyOf
v
Azure SQL Database
The relationship identifies the target resource through its Azure Resource Manager resource ID.
The relationship can be created at supported resource scopes, including resource groups, subscriptions, management groups, and tenant scope.
ServiceGroupMember
ServiceGroupMember connects a resource, resource group, or subscription to an Azure Service Group.
For example:
Production Services
|
+-------+-------+
| | |
v v v
API Database Storage
The service group provides a logical way to organize related resources.
Unlike a traditional parent-child hierarchy, service group membership can connect resources across subscriptions and resource groups.
This is useful when an application is distributed across multiple Azure environments.
Compare the Relationship Types
Relationship type | Purpose | Example |
|---|
DependencyOf | Represents a dependency between resources | API depends on SQL Database |
ServiceGroupMember | Connects a resource to a service group | API belongs to Production Services |
Service Group hierarchy | Organizes service groups under parent groups | Production Services belongs to Business Applications |
These concepts solve different problems.
DependencyOf describes a dependency. ServiceGroupMember provides logical grouping. A service group hierarchy organizes service groups themselves.
3. What Is the Azure.ResourceManager.Relationships .NET SDK?
Microsoft provides a dedicated Azure Resource Manager management library for working with relationships.
The NuGet package is:
Azure.ResourceManager.Relationships
The library follows the Azure SDK design guidelines and integrates with the standard Azure management infrastructure.
It provides programmatic support for:
Creating DependencyOf relationships.
Updating DependencyOf relationships.
Managing service group membership.
Listing supported relationship collections.
Working with Azure Resource Manager authentication.
Handling asynchronous management operations.
The SDK also supports common Azure SDK capabilities, including:
Azure Identity authentication.
OpenTelemetry distributed tracing.
Custom HTTP pipeline policies.
Standardized error handling.
Consistent Azure SDK telemetry.
Package Version
The library reached its first stable release with version 1.0.0 on October 19, 2026.
The November 2026 Azure SDK release list includes the stable package.
Install it using:
dotnet add package Azure.ResourceManager.Relationships --version 1.0.0
Install Azure Identity:
dotnet add package Azure.Identity
The package is a management library. It manages Azure relationship resources rather than collecting application telemetry or automatically discovering dependencies.
4. Understand the Relationship Data Model
Before creating relationships, developers should understand the information stored in them.
A dependency relationship connects a source resource with a target resource.
For example:
Source Resource:
Customer API
Target Resource:
Azure SQL Database
Relationship:
DependencyOf
The source is the resource on which the dependency is defined.
The target is the resource that the source depends on.
The Azure Resource Manager API represents the target through targetId.
For cross-tenant scenarios, the relationship model also supports targetTenant.
Example Dependency Relationship
The following JSON represents the important properties of a DependencyOf relationship:
{
"properties": {
"targetId": "/subscriptions/{subscriptionId}/resourceGroups/data-rg/providers/Microsoft.Sql/servers/orders-sql/databases/orders"
}
}
The targetId property contains the full resource identifier of the database.
The relationship is created as an extension resource under the source resource.
This means that the source resource's ARM identifier forms part of the relationship's resource path.
The distinction between source and target is important when designing dependency maps.
If an API depends on a database, the API should be represented as the source and the database as the target.
5. Configure Azure Authentication in a .NET Application
The Relationships SDK uses Azure Resource Manager authentication.
For local development, DefaultAzureCredential is a convenient authentication option.
It supports multiple authentication mechanisms, including Azure CLI credentials and managed identity.
Sign In Through Azure CLI
Run:
az login
Select the subscription:
az account set --subscription "YOUR-SUBSCRIPTION-ID"
Verify the selected subscription:
az account show
The authenticated identity can now be used by Azure SDK clients.
Configure Permissions
Authentication and authorization are separate.
The application must authenticate successfully and also have permission to manage the relationship resources.
For example, creating or updating a relationship requires appropriate write permissions for the Microsoft.Relationships resource provider at the relevant scope.
For production applications:
Use managed identity when available.
Assign permissions at the narrowest practical scope.
Avoid storing client secrets in source code.
Separate read-only monitoring identities from resource-management identities.
A monitoring application that only lists relationships should not automatically receive permission to create or delete them.
6. Understand How Dependency Relationships Are Created
The DependencyOf relationship is created as an extension resource under the source resource.
An extension resource adds additional information or functionality to an existing Azure resource without changing the underlying resource type.
For example, consider:
Application Resource
|
v
Microsoft.Relationships/dependencyOf
|
v
Database Resource
The relationship is attached to the application resource and identifies the database as its target.
The resource provider currently documents the 2026-08-01 API version for DependencyOf.
The following Bicep example demonstrates the relationship definition:
resource application 'Microsoft.Web/sites@2025-03-01' existing = {
name: 'customer-api'
}
resource databaseDependency 'Microsoft.Relationships/dependencyOf@2026-08-01' = {
scope: application
name: 'orders-database-dependency'
properties: {
targetId: '/subscriptions/{subscriptionId}/resourceGroups/data-rg/providers/Microsoft.Sql/servers/orders-sql/databases/orders'
}
}
Replace the example resource IDs and names with actual Azure resource identifiers.
The source is the existing App Service resource.
The targetId identifies the SQL database.
This example demonstrates the underlying Azure resource model. The .NET SDK provides a programmatic management interface for working with the same relationship resource type.
7. Create a Dependency Relationship Through an Authenticated .NET Application
The following example demonstrates the underlying Azure Resource Manager operation from C#.
It uses Azure Identity to obtain an access token and HttpClient to send the relationship request.
This is useful for understanding the ARM request structure and testing the relationship API independently of generated SDK model types.
It is an ARM REST example, not a call to a typed Relationships SDK collection method.
Create a .NET Console Application
dotnet new console -n AzureRelationshipsDemo
cd AzureRelationshipsDemo
Install the required packages:
dotnet add package Azure.Identity
dotnet add package Azure.ResourceManager.Relationships --version 1.0.0
Create the Relationship
Add the following code to Program.cs:
using System.Net.Http.Headers;
using System.Text;
using Azure.Core;
using Azure.Identity;
var credential = new DefaultAzureCredential();
var token = await credential.GetTokenAsync(
new TokenRequestContext(
new[] { "https://management.azure.com/.default" }));
var sourceResourceId =
"/subscriptions/{subscriptionId}/resourceGroups/api-rg/providers/Microsoft.Web/sites/customer-api";
var targetResourceId =
"/subscriptions/{subscriptionId}/resourceGroups/data-rg/providers/Microsoft.Sql/servers/orders-sql/databases/orders";
var relationshipName = "orders-database-dependency";
var requestUri =
$"https://management.azure.com{sourceResourceId}" +
$"/providers/Microsoft.Relationships/dependencyOf/" +
$"{relationshipName}?api-version=2026-08-01";
using var httpClient = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Put,
requestUri);
request.Headers.Authorization =
new AuthenticationHeaderValue(
"Bearer",
token.Token);
var requestBody = new
{
properties = new
{
targetId = targetResourceId
}
};
var json = System.Text.Json.JsonSerializer.Serialize(
requestBody);
request.Content = new StringContent(
json,
Encoding.UTF8,
"application/json");
using var response = await httpClient.SendAsync(request);
var responseContent =
await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
Console.WriteLine(
$"Request failed: {(int)response.StatusCode}");
Console.WriteLine(responseContent);
return;
}
Console.WriteLine("Dependency relationship request submitted.");
Console.WriteLine(responseContent);
Understand the Code
DefaultAzureCredential authenticates the application using the available Azure credentials.
The TokenRequestContext requests an access token for Azure Resource Manager.
The sourceResourceId identifies the resource that owns the relationship.
The targetResourceId identifies the resource on which the source depends.
The request uses HTTP PUT because the relationship is created or replaced at the specified relationship resource identifier.
The request body contains the targetId property.
The API version identifies the Microsoft.Relationships contract used by the request.
Important: Handle the Asynchronous Operation
Azure Resource Manager management operations may return an asynchronous operation response.
A successful request submission does not always mean that the relationship has finished provisioning.
For production code, inspect the response headers and follow the Azure-AsyncOperation or Location operation-status URL when returned.
Do not mark the relationship as fully created until the operation reaches a successful terminal state.
The exact response depends on the resource operation and API version.
8. Track Relationships Across Multiple Resources
A single application may depend on several Azure resources.
For example:
Customer API
|
+----------+----------+
| | |
v v v
SQL DB Key Vault Storage
| |
v v
Private Network Blob Container
Each dependency can be represented through an appropriate relationship.
A relationship inventory might look like this:
Source resource | Target resource | Relationship |
|---|
Customer API | Orders SQL Database | DependencyOf |
Customer API | Key Vault | DependencyOf |
Customer API | Storage Account | DependencyOf |
Storage Account | Private Endpoint | DependencyOf |
These examples describe an application's logical dependencies. They should only be recorded when they reflect the actual architecture.
Why Maintain a Dependency Inventory?
A dependency inventory helps answer important operational questions:
Which applications depend on a database?
Which services use a particular Key Vault?
Which resources may be affected by a planned change?
Which applications should be investigated after a resource failure?
Which infrastructure components belong to a particular business service?
This information can be consumed by internal dashboards, incident-management systems, and architecture tools.
However, a relationship record does not guarantee that Azure automatically understands the operational impact of every dependency.
The application or monitoring platform must interpret the graph and combine it with health information.
9. Understand Azure Service Groups
Azure Service Groups provide a logical way to organize resources across different scopes.
A service group can contain:
For example, an organization may have separate subscriptions for production, staging, and development.
A service group can represent a business application and connect the resources required by that application.
Business Applications
|
Customer Platform
|
+--------+--------+
| | |
v v v
Production Staging Development
| | |
v v v
API API API
| | |
v v v
SQL SQL SQL
This structure provides a logical grouping that is not restricted to a single resource group.
Service Group Hierarchy vs. Membership
These concepts should not be confused.
A service group can have a parent service group, creating a hierarchy.
ServiceGroupMember is a separate relationship resource that connects an Azure resource, resource group, or subscription to a service group.
For example:
Parent Service Group
|
v
Production Applications
|
+-------------------+
| |
v v
Customer API Order API
The membership relationship is flexible and can connect resources across different subscriptions.
Unlike parent-child service group hierarchy, membership does not provide inherited permissions.
Azure Service Groups are currently documented as a public-preview capability, so review the applicable preview terms and service limitations before adopting them for production governance.
10. Create Service Group Membership
A resource can be connected to a service group using a ServiceGroupMember relationship.
The relationship is created as an extension resource under the member resource.
For example, a virtual machine can become a member of a service group.
The following JSON demonstrates the relationship properties:
{
"properties": {
"targetId": "/providers/Microsoft.Management/serviceGroups/production-services"
}
}
Here, targetId identifies the service group.
The source resource is identified by the resource scope in the relationship URL.
For example:
/subscriptions/{subscriptionId}
/resourceGroups/production-rg
/providers/Microsoft.Compute/virtualMachines/api-server
/providers/Microsoft.Relationships/serviceGroupMember/{relationshipName}
The API request uses the Microsoft.Relationships provider.
Example Using Azure Resource Manager REST
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/production-rg/providers/Microsoft.Compute/virtualMachines/api-server/providers/Microsoft.Relationships/serviceGroupMember/api-server-membership?api-version=2023-09-01-preview
Authorization: Bearer {accessToken}
Content-Type: application/json
Request body:
{
"properties": {
"targetId": "/providers/Microsoft.Management/serviceGroups/production-services"
}
}
This illustrates the service-group membership resource format documented for the preview API.
The stable Relationships .NET SDK provides typed management support for service group membership. When implementing the typed SDK version, use the API reference for the installed package rather than copying REST model names into C# without checking their generated signatures.
11. List and Inspect Relationships
Creating relationships is only one part of dependency management.
A useful system must also retrieve existing relationships.
The Relationships SDK supports pageable enumeration for supported relationship collections.
The stable 1.0.0 release includes additional APIs for:
Listing Contains relationships at resource group scope.
Listing Contains relationships at subscription scope.
Managing DependencyOf relationships scoped to a service group.
Enumerating DependencyOf relationship collections.
Enumerating service group member relationship collections.
The Contains relationship is useful for understanding resource containment and grouping information.
When working with large Azure environments, pageable enumeration is important because one request may not return every relationship.
Why Pagination Matters
Consider a subscription containing thousands of resources.
A relationship inventory may contain many records.
Instead of expecting one API response to contain everything, Azure returns results in pages.
The SDK's asynchronous pageable collections allow developers to iterate through the results.
A general Azure SDK enumeration pattern looks like this:
await foreach (var item in pageableResults)
{
Console.WriteLine(item);
}
The actual pageable collection must come from the relevant Relationships SDK operation.
This pattern allows the SDK to request subsequent pages when needed.
For a production dependency inventory, store the resource ID, relationship type, source, target, and retrieval timestamp in a suitable data store.
This makes it possible to compare dependency changes over time.
12. Build a Practical Dependency Mapping Architecture
Let's consider an enterprise application with three major components:
Customer API.
Orders Database.
Shared Key Vault.
The Customer API depends on the database and Key Vault.
The organization also wants to group all production resources under a service group.
A practical architecture looks like this:
Azure Subscription
|
v
Production Resource Group
|
+---------+---------+
| | |
v v v
Customer Orders Shared
API SQL Key Vault
| ^ ^
| | |
+---------+---------+
DependencyOf
|
v
Relationship
Inventory
|
v
Monitoring System
|
v
Dependency Map
A separate ServiceGroupMember relationship connects the resources to the production service group.
Suggested Application Components
Component | Responsibility |
|---|
Relationship manager | Creates and updates relationship resources |
Azure identity provider | Authenticates the application |
Dependency inventory | Stores discovered relationship records |
Monitoring service | Reads resource health and operational signals |
Dependency analyzer | Determines which applications may be affected |
Dashboard | Displays resource relationships |
The Relationships SDK handles Azure relationship management.
The monitoring and dependency-analysis components are application responsibilities.
This separation makes the architecture easier to maintain and test.
13. Combine Relationships With Azure Resource Health
Dependency information becomes more valuable when combined with resource health information.
For example, suppose Azure Resource Health reports that a database is unavailable.
The monitoring application can use the dependency map to identify applications that depend on that database.
The workflow can look like this:
Azure Resource Health
|
v
Database Unavailable
|
v
Read Dependency Relationships
|
v
Find Dependent Applications
|
v
Calculate Potential Impact
|
v
Create Incident
|
v
Notify Operations Team
This can help reduce investigation time.
However, the dependency map must be accurate and current.
If a new application dependency is introduced but the relationship is not updated, the impact analysis may be incomplete.
A production system should therefore update relationship records whenever infrastructure or application dependencies change.
14. Troubleshoot Common Relationship Management Problems
Authorization Failed
A request may fail even when Azure authentication succeeds.
Verify that the identity has the required permission to create, update, or list the relationship resource.
Check role assignments at the appropriate resource, resource-group, subscription, or service-group scope.
Resource Not Found
If the API cannot find the source or target resource, verify the full ARM resource identifier.
A resource ID should include the correct subscription, resource group, provider namespace, resource type, and resource name where applicable.
Relationship Creation Is Accepted but Not Complete
Some Azure management operations are asynchronous.
A successful submission may return an accepted response while Azure continues processing the request.
Follow the operation-status URL when supplied.
Incorrect Source and Target
The source and target have different meanings.
For DependencyOf, the source is the resource that depends on another resource.
The target is the resource being depended upon.
Reversing these identifiers can produce an incorrect dependency map.
Service Group Membership Does Not Appear
Verify that:
The service group exists.
The targetId identifies the correct service group.
The source scope identifies the intended resource.
The membership relationship was successfully provisioned.
The relationship is being queried at the correct scope.
Pagination Returns Incomplete Results
When enumerating relationship collections, use the SDK's pageable iteration pattern.
Do not assume that the first response contains every relationship.
Also check whether the selected API operation lists the relationship type and scope you actually need.
15. Best Practices for Managing Azure Relationships
Keep Relationships Updated
Update relationship records whenever application architecture or infrastructure dependencies change.
Outdated relationships can produce incorrect dependency maps.
Use Full Resource Identifiers
Use complete Azure Resource Manager resource IDs.
Avoid relying only on resource names because different resource groups or subscriptions can contain resources with identical names.
Separate Dependency and Grouping Information
Use DependencyOf to represent actual dependencies.
Use ServiceGroupMember to organize resources logically.
Do not use service group membership as a substitute for dependency mapping.
Use Least-Privilege Permissions
Give monitoring applications read access where possible.
Use separate identities for creating or modifying relationship resources.
Handle Cross-Subscription Scenarios Carefully
Enterprise environments often contain multiple subscriptions and tenants.
Validate the resource identifiers and tenant information before creating cross-scope relationships.
Automate Relationship Updates
Consider integrating relationship management into infrastructure deployment pipelines.
When a new application dependency is introduced, the corresponding relationship should be created as part of the deployment process.
Monitor Relationship Provisioning
Do not assume that an accepted management request has completed successfully.
Track asynchronous operations and record failures.
Maintain a Historical Inventory
For incident analysis, retain relationship snapshots or changes over time.
This helps teams understand how an application's dependencies changed before an outage.
16. Advantages and Limitations
Advantages
Dependency visibility: Organizations can represent relationships between Azure resources explicitly.
Cross-scope organization: Resources can be grouped across subscriptions and resource groups.
Programmatic management: The .NET SDK supports automated relationship management.
Incident investigation: Dependency information can help identify applications potentially affected by infrastructure failures.
Governance support: Service groups provide logical organization for enterprise resources.
Integration with Azure SDK: The library uses Azure Identity and standard Azure management infrastructure.
Pageable enumeration: Supported relationship collections can be retrieved without manually managing continuation tokens.
Limitations
Manual relationship maintenance: Azure does not automatically discover every application dependency.
Permission requirements: Relationship operations require appropriate Azure authorization.
Data accuracy: Incorrect or outdated relationships can affect dependency analysis.
Service Group preview status: Azure Service Groups are currently documented as a public-preview capability.
Not a monitoring replacement: Relationships describe connections but do not independently report resource health or application performance.
Cross-scope complexity: Large organizations must carefully manage subscription, tenant, and resource identifiers.
Conclusion
Azure Resource Manager Relationships provides a way to represent connections between Azure resources as manageable resource objects.
The Azure.ResourceManager.Relationships library brings this capability into .NET applications, allowing development and platform teams to manage dependency relationships and service group membership programmatically.
DependencyOf helps describe which resources depend on other resources, while ServiceGroupMember connects resources to logical service groups.
When combined with Azure Resource Health and Azure Monitor, these relationships can support dependency mapping, incident investigation, change management, and infrastructure governance.
The most important implementation requirement is maintaining accurate relationship information. The SDK provides the management capabilities, but organizations must ensure that their application and infrastructure dependencies are represented correctly.
For enterprise .NET applications running across multiple Azure subscriptions, this provides a useful foundation for building a more connected view of cloud infrastructure.
Join the conversation! Your thoughts help the community grow.