https://pulumi.com logo
#getting-started
Title
# getting-started
n

numerous-solstice-19110

05/29/2023, 4:16 PM
I have a strange issue. I'm new to pulumi, just work with in two weeks. I'm using pulumi with C# I create a stack, then I add a config:
Copy code
pulumi config set azure:clientid <value>
The config looks like this:
Copy code
config:
   azure:clientid: <the value>
then I read the config
Copy code
var config = new Pulumi.Config();
var clientId = config.Require("azure:clientId");
Run pulumi up and then it complain that "IaCazureclientId" does not exist. and if I do like this: (add a config value with up command)
Copy code
pulumi config set azure:clientid <value>
pulumi up -c SERVICE_ID=22442
it make the file look like:
Copy code
config:
   IaC:SERVICE_ID: 22422
   azure:clientid: the value
it adds a prefix to my SERVICE_ID and if I ask for the SERVICE_ID like this
Copy code
var clientId = config.Require(SERVICE_ID");
it will find that one, but can't still find:
Copy code
var clientId = config.Require("azure:clientId");
but if I remove the azure: and just do:
Copy code
pulumi config set clientid <value>
it gives me:
Copy code
config:
   IaC:clientid: the value
in the file. and:
Copy code
var clientId = config.Require("clientId");
works. Why can't I just use other namespaceing like azure:something and retrieve the data without it say it does not exist and try to look for "IaCazuresomething" The IaC seams to come from pulumi.yaml name: IaC filed like a prefix. I expect:
Copy code
pulumi config set azure:clientid <value>
to give me as it is:
Copy code
config:
   azure:clientid: the value
but not complain about it missing and try to look for IaCazureclientId what am I doing wrong? so lost, read the documentation and I can't get this... a bug or am I just stupid? :D
b

billowy-army-68599

05/29/2023, 4:37 PM
Copy code
pulumi config set azure:clientid <value>
This isn’t correct, it needs to be
azure:clientId
- note the casing
Copy code
var config = new Pulumi.Config();
var clientId = config.Require("azure:clientId");
This is also incorrect, config is namespaced, so you’d need to do:
Copy code
var config = new Pulumi.Config("azure");
var clientId = config.Require("clientId");
Config is namespaced. Again, note the casing.
n

numerous-solstice-19110

05/29/2023, 4:39 PM
ok. so when I add my own namespace I need to say in the Pulumi.Config to tell it to use my configs from that section? so pulumi config set aws:foo <value>
Copy code
var config = new Pulumi.Config("aws");
var clientId = config.Require("foo");
?
b

billowy-army-68599

05/29/2023, 4:42 PM
yes that’s right
but provider namespaces are reserved for that provider
so if you use the AWS provider
var config = new Pulumi.Config("aws");
needs a valid value from the AWS provider
n

numerous-solstice-19110

05/29/2023, 4:44 PM
ok. What I do it that in Powershell I create an app registration and a sercvice principle for that one. I can't do it with Pulumi because I can't set the build server as an owner to tha app registration. So in that case I want to store the serviceprinciple to my config. that's why i named it azure:clientId but then it might be bad to say azure: I wanted to namespace all settings I might need to add for azure parts to my pulumi.<env>.yamls
b

billowy-army-68599

05/29/2023, 4:46 PM
no that’s exactly what you need to do to authenticate to azure https://www.pulumi.com/registry/packages/azure/api-docs/provider/#clientid