Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Not applicable

Create a mutable global variable in M language

Hi, community, 

I'm working on a custom connector that needs to authenticate before data representation is done, and to do this I don't want to hardcode the auth credentials in my source code. 


So, I declared a global list variable named


config = {"a"};



and in the shared MyCustomConnector.Contents function, I'm doing a List.ReplaceValue on item "a" in the list above.


shared MyCustomConnector.Contents = (BaseUrl as text, ClientId as text) => 
List.ReplaceValue(config, "a", BaseUrl, Replacer.ReplaceText);



so in my StartLogin function, I can just call the config by index like this.


//Start Login
StartLogin = (resourceUrl, state, display) =>

        AuthorizeUrl ="https://"&Text.From(config{0})&"/oauth/authorize?" & Uri.BuildQueryString(
                client_id = "11",
                state = state,
                redirect_uri = redirect_uri
            LoginUri = AuthorizeUrl,
            CallbackUri = redirect_uri,
            WindowHeight = windowHeight,
            WindowWidth = windowWidth,
            Context = null



But it appears that, the List.ReplaceValue is not being executed because whenever I try to set credential for authentication, "a" is being passed into the URL. 


Any help will be much appreciated

Super User
Super User

Please read Ben Gribaudo's primer again.


Have a look at the meta data section too.

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors