Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue 24840 #24843

Merged
merged 3 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/resources/Azure.ResourceManager.Resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur
Install the Azure Resources management library for .NET with [NuGet](https://www.nuget.org/):

```PowerShell
Install-Package Azure.ResourceManager.Resources -Version 1.0.0-preview.2
Install-Package Azure.ResourceManager.Resources -Version 1.0.0-beta.2
```

### Prerequisites
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ description: Samples for the Azure.ResourceManager.Resources client library
# Azure.ResourceManager.Resources Samples

- [Managing Application Definitions](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md)
- [Managing Deployment Extended](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md)
- [Managing Deployments](https://github.com/Yao725/azure-sdk-for-net/blob/fix-issue-24840/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md)
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ await applicationDefinition.DeleteAsync();


## Next steps
Take a look at the [Managing Deployment Extended](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md) samples.
Take a look at the [Managing Deployments](https://github.com/Yao725/azure-sdk-for-net/blob/fix-issue-24840/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md) samples.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Example: Managing the deployment extendeds
# Example: Managing the deployments

>Note: Before getting started with the samples, go through the [prerequisites](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/resourcemanager/Azure.ResourceManager#prerequisites).

Namespaces for this example:
```C# Snippet:Manage_DeploymentExtendeds_Namespaces
```C# Snippet:Manage_Deployments_Namespaces
using System;
using System.Threading.Tasks;
using Azure.Identity;
Expand All @@ -30,16 +30,16 @@ ResourceGroupCreateOrUpdateOperation lro = await rgContainer.CreateOrUpdateAsync
ResourceGroup resourceGroup = lro.Value;
```

Now that we have the resource group created, we can manage the deployment extendeds inside this resource group.
Now that we have the resource group created, we can manage the deployments inside this resource group.

***Create a deployment extendeds***
***Create a deployment***

```C# Snippet:Managing_DeploymentExtendeds_CreateADeploymentExtended
// First we need to get the deployment extended container from the resource group
DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds();
```C# Snippet:Managing_Deployments_CreateADeployment
// First we need to get the deployment container from the resource group
DeploymentContainer deploymentContainer = resourceGroup.GetDeployments();
// Use the same location as the resource group
string deploymentExtendedName = "myDeployment";
var input = new Deployment(new DeploymentProperties(DeploymentMode.Incremental)
string deploymentName = "myDeployment";
var input = new DeploymentInput(new DeploymentProperties(DeploymentMode.Incremental)
{
TemplateLink = new TemplateLink()
{
Expand All @@ -54,30 +54,34 @@ var input = new Deployment(new DeploymentProperties(DeploymentMode.Incremental)
}
}
});
DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentExtendedContainer.CreateOrUpdateAsync(deploymentExtendedName, input);
DeploymentExtended deploymentExtended = lro.Value;
DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentContainer.CreateOrUpdateAsync(deploymentName, input);
Deployment deployment = lro.Value;
```

***List all deployment extendeds***
***List all deployments***

```C# Snippet:Managing_DeploymentExtendeds_ListAllDeploymentExtendeds
// First we need to get the deployment extended container from the resource group
DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds();
// With GetAllAsync(), we can get a list of the deployment extendeds in the container
AsyncPageable<DeploymentExtended> response = deploymentExtendedContainer.GetAllAsync();
await foreach (DeploymentExtended deploymentExtended in response)
```C# Snippet:Managing_Deployments_ListAllDeployments
// First we need to get the deployment container from the resource group
DeploymentContainer deploymentContainer = resourceGroup.GetDeployments();
// With GetAllAsync(), we can get a list of the deployments in the container
AsyncPageable<Deployment> response = deploymentContainer.GetAllAsync();
await foreach (Deployment deployment in response)
{
Console.WriteLine(deploymentExtended.Data.Name);
Console.WriteLine(deployment.Data.Name);
}
```

***Delete a deployment extendeds***
***Delete a deployment***

```C# Snippet:Managing_DeploymentExtendeds_DeleteADeploymentExtended
// First we need to get the deployment extended container from the resource group
DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds();
// Now we can get the deployment extended with GetAsync()
DeploymentExtended deploymentExtended = await deploymentExtendedContainer.GetAsync("myDeployment");
// With DeleteAsync(), we can delete the deployment extended
await deploymentExtended.DeleteAsync();
```C# Snippet:Managing_Deployments_DeleteADeployment
// First we need to get the deployment container from the resource group
DeploymentContainer deploymentContainer = resourceGroup.GetDeployments();
// Now we can get the deployment with GetAsync()
Deployment deployment = await deploymentContainer.GetAsync("myDeployment");
// With DeleteAsync(), we can delete the deployment
await deployment.DeleteAsync();
```


## Learn more
Take a look at the [ARM template documentation](https://docs.microsoft.com/azure/azure-resource-manager/templates/).
Loading