Describe the bug
Customer can get "instanceView" of ACI about 5 months ago but they cannot retrieve them without changing package version.
On the other hands, they can get that property using Azure CLI and Azure portal.
Exception or Stack Trace
None of the exceptions occurs.
To Reproduce
Install relating packages.
Below command get the latest package but other versions get the same result.
using System.Linq;
using Microsoft.Azure.Management.ContainerInstance.Fluent;
using Microsoft.Azure.Management.ContainerInstance.Fluent.Models;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Rest;
using System.Threading.Tasks;
using System;
namespace aciApp
{
class Program
{
static async Task Main(string[] args)
{
string tenantId = "<Tenant Id>";
string subscriptionId = "<Subscription Id>";
string resourceGroupName = "<Resource Group Name";
var azureServiceTokenProvider = new AzureServiceTokenProvider(); // via MSI
var armToken = await azureServiceTokenProvider.GetAccessTokenAsync("https://management.azure.com/", tenantId).ConfigureAwait(false);
var graphToken = await azureServiceTokenProvider.GetAccessTokenAsync("https://graph.windows.net/", tenantId).ConfigureAwait(false);
var credentials = new AzureCredentials(
new TokenCredentials(armToken),
new TokenCredentials(graphToken),
tenantId,
AzureEnvironment.AzureGlobalCloud)
.WithDefaultSubscription(subscriptionId);
var restClient = RestClient.Configure()
.WithEnvironment(AzureEnvironment.AzureGlobalCloud)
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.WithCredentials(credentials)
.Build();
var containerInstanceClient = new ContainerInstanceManagementClient(restClient)
{
SubscriptionId = restClient.Credentials.DefaultSubscriptionId
};
var instances = await containerInstanceClient.ContainerGroups.ListByResourceGroupAsync(resourceGroupName);
foreach (var i in instances)
{
Console.WriteLine("*****");
//List<Container> cointainers = i.Containers as List<Container>;
Console.WriteLine(i.Containers.Count.ToString());
Console.WriteLine(i.Containers.FirstOrDefault()?.Name);
Console.WriteLine(i.Containers.FirstOrDefault()?.InstanceView?.CurrentState?.State);
Console.WriteLine(i.Containers.FirstOrDefault()?.InstanceView?.CurrentState?.DetailStatus);
Console.WriteLine("*****");
}
}
}
}
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
@yuriwoof commented on Sun May 05 2019
Describe the bug Customer can get "instanceView" of ACI about 5 months ago but they cannot retrieve them without changing package version. On the other hands, they can get that property using Azure CLI and Azure portal.
Exception or Stack Trace None of the exceptions occurs.
To Reproduce
Below command get the latest package but other versions get the same result.
Code Snippet
The output is following.
Expected behavior
The expected output is here.
Thought Azure CLI can get those properties.
Screenshots N/A
Setup (please complete the following information):
Additional context N/A
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
@kurtzeborn commented on Mon May 06 2019
Thank you for opening this issue! We are routing it to the appropriate team for follow up.