public async Task ListApplicationDefinitions() { #region Snippet:Managing_ApplicationDefinitions_ListAllApplicationDefinitions // First we need to get the application definition container from the resource group ApplicationDefinitionContainer applicationDefinitionContainer = resourceGroup.GetApplicationDefinitions(); // With GetAllAsync(), we can get a list of the application definitions in the container AsyncPageable <ApplicationDefinition> response = applicationDefinitionContainer.GetAllAsync(); await foreach (ApplicationDefinition applicationDefinition in response) { Console.WriteLine(applicationDefinition.Data.Name); } #endregion Snippet:Managing_ApplicationDefinitions_ListAllApplicationDefinitions }
public async Task DeleteApplicationDefinitions() { #region Snippet:Managing_ApplicationDefinitions_DeleteAnApplicationDefinition // First we need to get the application definition container from the resource group ApplicationDefinitionContainer applicationDefinitionContainer = resourceGroup.GetApplicationDefinitions(); // Now we can get the application definition with GetAsync() ApplicationDefinition applicationDefinition = await applicationDefinitionContainer.GetAsync("myApplicationDefinition"); // With DeleteAsync(), we can delete the application definition await applicationDefinition.DeleteAsync(); #endregion Snippet:Managing_ApplicationDefinitions_DeleteAnApplicationDefinition }
public async Task CreateApplicationDefinitions() { #region Snippet:Managing_ApplicationDefinitions_CreateAnApplicationDefinition // First we need to get the application definition container from the resource group ApplicationDefinitionContainer applicationDefinitionContainer = resourceGroup.GetApplicationDefinitions(); // Use the same location as the resource group string applicationDefinitionName = "myApplicationDefinition"; var input = new ApplicationDefinitionData(resourceGroup.Data.Location, ApplicationLockLevel.None) { DisplayName = applicationDefinitionName, Description = $"{applicationDefinitionName} description", PackageFileUri = "https://raw.githubusercontent.com/Azure/azure-managedapp-samples/master/Managed%20Application%20Sample%20Packages/201-managed-storage-account/managedstorage.zip" }; ApplicationDefinitionCreateOrUpdateOperation lro = await applicationDefinitionContainer.CreateOrUpdateAsync(applicationDefinitionName, input); ApplicationDefinition applicationDefinition = lro.Value; #endregion Snippet:Managing_ApplicationDefinitions_CreateAnApplicationDefinition }