Azure / Azure/bicep-types-az

Getting subscription offer type

Open
#2,184 1 comment 0 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

**Bicep version**
run `bicep --version` via the Bicep CLI, `az bicep version` via the AZ CLI or via VS code by navigating to the extensions tab and searching for Bicep
Bicep CLI version 0.26.54 (5e20b29b58)

**Describe the bug**
We try running the following code in bicep to determine the offer type of our azure subscription. Using this information, we want to deploy a virtual network peering with either our production hub or our devtest hub, expecting either a value of 'Enterprise Agreement' or 'Enterprise DevTest' or the correlating offer ID's (MS-AZR-0017P or MS-AZR-0148P, respectively)

```
resource currentSubscription 'Microsoft.Subscription/subscriptionDefinitions@2017-11-01-preview' existing = {
scope: tenant()
name: '${subscription('insertsubscriptionid')}'
}

output currentSubscription string = currentSubscription.properties.offerType
```

Running this code returns the following error, however:
New-AzSubscriptionDeployment -Location 'West Europe' -TemplateFile '.\temp.bicep'
New-AzDeployment: 10:02:44 AM - The deployment 'temp' failed with error(s). Showing 1 out of 1 error(s).
Status Message: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. (Code:BadRequest)

**To Reproduce**
Steps to reproduce the behavior:
We have attempted running the same code with different subscriptions, and also tried multiple Resource Providers, to no avail.

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the subscriptionDefinitions resource example with the Bicep CLI or Azure CLI, using the listed Microsoft.Subscription API version and deployment command. Check whether the offerType property is available for the existing resource and whether the BadRequest response is consistent across subscriptions. Done means identifying a supported way to retrieve the offer type or documenting that this resource and property cannot provide it.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.