Azure-Samples / Azure-Samples/azure-sdk-for-go-samples

[question]: correct way to list VMs via API

Open
#289 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
308
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Thank you for your contribution and feedback! Help us review faster by providing the following information:

## This issue is a: (mark with an `x`)

- [X] question
- [ ] bug report
- [ ] request for new sample
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

## Steps to reproduce:

I'm trying to get a list of VMs, I'm running this call:

```golang
i.compute.ListComplete(context, resourceGroupName)
```
and I get an empty result, not an error.

If I do the same from the command line:
```shell
az vm list -g cluster-raffa-zqh7w-rg
```
using the same resourceGroupName, I get the expected result?
What am I doing wrong? Could this be a permission issue?
Currently the account used to make the call has this role: `"Virtual Machine Contributor"`.

I get the same empty result set also with:

```golang
i.compute.List(context, resourceGroupName)
```

Contributor guide

Open the contributing guide

Research direction

Start with the Go entry points shown in the issue, compute.ListComplete and compute.List, and compare their resource-group and subscription context with the az vm list command. Determine why both calls return an empty result despite the stated role, then document the correct API usage or required permissions and verify it returns the expected VMs.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, go
Domain
api, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.