Description
Describe the bug
Delete Resource Group request was made using azure java sdk. The delete resource group request was a blocking call and no exception/error was thrown. But on checking the resource group in azure portal, it was not deleted due to issue in deleting azure cluster.
Exception or Stack Trace
{"Error":{"Code":"ResourceDeletionFailed","Target":null,"Message":"The request to delete the resource 'Microsoft.ContainerService/managedClusters/65049f8921b3505b7da738b0-edge' failed. subscription id 'f642dc8a-5d3a-45a6-973b-2a0ae5ea2ec4', activity id '71fe1457-756b-4d6b-811d-e0083738948d', request correlation id '820ab55a-0eb3-4a90-af98-89a25177787a'.","Details":null,"AdditionalInfo":null}}
To Reproduce
This issue occurred only once and we have not been able to reproduce it again. But we would like to understand the root cause so that we can take appropriate measures if it occurs again in production environment.
Code Snippet
Here are the maven dependencies in the project.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-boot-bom</artifactId>
<version>4.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-sdk-bom</artifactId>
<version>1.2.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Main Azure Resource Manager dependency -->
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-resources</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-marketplaceordering</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<exclusions>
<!-- Excluding netty as we are using okHttp client -->
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
</dependency>
...
<dependencies>
Here is the code snippet for calling azure sdk method
try {
azureResourceManager.resourceGroups().deleteByName(resourceGroupName);
log.info("Successfully deleted resourceGroup {}", resourceGroupName);
} catch (Exception var3) {
throw AzureException.fromAzureError(var3).logErrorAsInfo(log);
}
On checking the sdk code, here is the snippet from the sdk code
@Override
public void deleteByName(String name) {
deleteByNameAsync(name).block();
}
@Override
public Mono<Void> deleteByNameAsync(String name) {
return manager().serviceClient().getResourceGroups().deleteAsync(name);
}
Expected behavior
The resource group should have been deleted but it was not deleted. If there was any failure during resource group deletion it should have been returned as an exception.
Screenshots
Not available
Setup (please complete the following information):
- OS: Linux
- IDE: Intellij
- Library/Libraries: Maven dependencies are added in Code snippets.
- Java version: 11
- App Server/Environment: Tomcat
- Frameworks: Spring Boot
Additional context
Not available
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added