Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,18 @@ public static AzureTokenWrapper getAzureCLICredential() throws IOException {
// /src/main/java/com/microsoft/azure/credentials/AzureCliCredentials.java#L48
// AzureCliCredentials.create will block using System.in.read() if user has logout using `az logout`
// here we must check these two json files for empty
final List tokens = JsonUtils.fromJson(FileUtils.readFileToString(accessTokens, "utf8"), List.class);
if (tokens.isEmpty()) {
return null;
}
final Wrapper wrapper = JsonUtils.fromJson(FileUtils.readFileToString(azureProfile, "utf8"), Wrapper.class);
if (wrapper.subscriptions == null || wrapper.subscriptions.isEmpty()) {
return null;
if (azureProfile.exists() && accessTokens.exists()) {
final List tokens = JsonUtils.fromJson(FileUtils.readFileToString(accessTokens, "utf8"), List.class);
if (tokens.isEmpty()) {
return null;
}
final Wrapper wrapper = JsonUtils.fromJson(FileUtils.readFileToString(azureProfile, "utf8"), Wrapper.class);
if (wrapper.subscriptions == null || wrapper.subscriptions.isEmpty()) {
return null;
}
return new AzureTokenWrapper(AuthMethod.AZURE_CLI,
AzureCliCredentials.create(azureProfile, accessTokens), azureProfile, accessTokens);
}
return new AzureTokenWrapper(AuthMethod.AZURE_CLI,
AzureCliCredentials.create(azureProfile, accessTokens), azureProfile, accessTokens);
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion azure-maven-plugin-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<powermock.version>2.0.2</powermock.version>
<jaxb.version>2.3.2</jaxb.version>
<zeroturnaround.zip.version>1.13</zeroturnaround.zip.version>
<azure.auth.helper.version>0.2.0</azure.auth.helper.version>
<azure.auth.helper.version>0.3.0-SNAPSHOT</azure.auth.helper.version>
<azure-tools-common.version>0.1.0-SNAPSHOT</azure-tools-common.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion azure-tools-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-auth-helper</artifactId>
<version>0.2.0</version>
<version>0.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down