Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

azure functions created in one cloud location for example south India should be able to create resource group in location central US

$
0
0

azure functions created in one cloud location for example south India should be able to create resource group in location central US

I want a clear step by step approach if this is possible.

const { ResourceManagementClient } = require("@azure/arm-resources");module.exports = async function (context, req) {    const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];    const credentials = new DefaultAzureCredential();    const resourceClient = new ResourceManagementClient(credentials, subscriptionId);    const resourceGroupName = "demoDiffResourceGroup";    const resourceGroupParameters = {        location: "centralus"    };    context.log(`Creating resource group: ${resourceGroupName} in Central US`);    try {        const result = await resourceClient.resourceGroups.createOrUpdate(resourceGroupName, resourceGroupParameters);        context.res = {            body: `Resource group created successfully: ${result.name}`        };    } catch (err) {        context.res = {            status: 500,            body: `Error creating resource group: ${err.message}`        };    }};

Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>