Azure / Azure/bicep

When using `az.getSecret` with local deploy, the deployment fails with `One or more errors occurred. (Object reference not set to an instance of an object.)` without mentioning the error comes from the `az.getSecret` function call

Open
#19,753 0 comments 0 reactions 0 assignees View on GitHub
Local Deploy
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
Bicep CLI version 0.43.8 (https://github.com/Azure/bicep/commit/310735909d06b992836c3957e5f4d13f802b8913)
**Describe the bug**
While trying to test local-deploy for a fix to #19750, I was encountering the following error while trying to deploy a real production deployment we used.

```
TRACE: Error: operationName=DeploymentEngine.PrepareParametersForDeployment, message=Deployment definition properties exist?: True,
TRACE: Error: operationName=DeploymentEngine.PrepareParametersForDeployment, message=Parameters link exists?: False,
TRACE: Error: operationName=DeploymentEngine.PrepareParametersForDeployment, message=Deployment definition properties exist?: True,
╭╮
╰╯
╭──────────────────────────────────────────────────────────────────────────────╮
│ Error │
├──────────────────────────────────────────────────────────────────────────────┤
│ One or more errors occurred. (Object reference not set to an instance of an │
│ object.) (Object reference not set to an instance of an object.) (Object │
│ reference not set to an instance of an object.) │
```

After some debugging, I found that the root cause was the call `az.getSecret` inside the bicep param

**To Reproduce**
main.bicep :

```bicep
param someParam string
```

main.bicepparam:

```bicep
param someParam az.getSecret('subId", "subRg', 'kvName', 'secretName'
```

Contributor guide

Open the contributing guide

Research direction

Start with the local deployment using main.bicep and main.bicepparam, focusing on the param value that calls az.getSecret. Reproduce the failure and trace how that call is reported during deployment preparation; done means the error identifies az.getSecret instead of only showing the null-reference message.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.