Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Azure.Provisioning.ResourceGraph simplifies declarative resource provisioning for Azure Resource Graph in .NET.
Getting started
Install the package
Install the client library for .NET with NuGet:
dotnet add package Azure.Provisioning.ResourceGraph --prerelease
Prerequisites
You must have an Azure subscription.
Authenticate the Client
Key concepts
This library allows you to specify your infrastructure in a declarative style using dotnet. You can then use azd to deploy your infrastructure to Azure directly without needing to write or maintain bicep or arm templates.
Examples
Create a Resource Graph Shared Query
This example demonstrates how to create a Resource Graph shared query that counts virtual machines by OS type, based on the Azure quickstart template.
Infrastructure infra = new();
ProvisioningParameter queryCode = new(nameof(queryCode), typeof(string))
{
Description = "The Azure Resource Graph query to be saved to the shared query.",
Value = "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)",
};
infra.Add(queryCode);
ProvisioningParameter queryDescription = new(nameof(queryDescription), typeof(string))
{
Description = "The description of the saved Azure Resource Graph query.",
Value = "This shared query counts all virtual machine resources and summarizes by the OS type.",
};
infra.Add(queryDescription);
ResourceGraphQuery query =
new(nameof(query))
{
Query = queryCode,
Description = queryDescription,
};
infra.Add(query);
Troubleshooting
- File an issue via GitHub Issues.
- Check previous questions or ask new ones on Stack Overflow using Azure and .NET tags.
Next steps
Contributing
For details on contributing to this repository, see the contributing guide.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (for example, label, comment). Follow the instructions provided by the bot. You'll only need to do this action once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any other questions or comments.