%3CLINGO-SUB%20id%3D%22lingo-sub-1895337%22%20slang%3D%22en-US%22%3EPublish%20Azure%20Bot%20Framework%20Composer%20Bot%20to%20already%20existing%20Resource%20Group.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1895337%22%20slang%3D%22en-US%22%3E%3CP%3EFollow%20the%20same%20steps%20mentioned%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcomposer%2Fhow-to-publish-bot%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPublish%20a%20bot%20to%20Azure%20-%20Bot%20Composer%20%7C%20Microsoft%20Docs%3C%2FA%3E%26nbsp%3B%20However%20to%20publish%20Azure%20Bot%20Framework%20Composer%20Bot%20to%20already%20existing%20Resource%20Group%2C%20follow%20below%20steps.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20find%20the%20provisioning%20steps%20in%20the%20%3CSTRONG%3Ereadme.md%3C%2FSTRONG%3E%20file%20which%20is%20automatically%20created%20when%20you%20create%20a%20new%20Bot%20in%20Bot%20Composer.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Untitled%20picture.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F234125i5C2BA5CC4C962289%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Untitled%20picture.png%22%20alt%3D%22Untitled%20picture.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAs%20of%20now%2C%20by%20default%2C%20provisioning%20script%20creates%20a%20new%20Resource%20Group%20appending%20environment%20value%20to%20it%20and%20does%20not%20deploy%20the%20services%20to%20an%20existing%20Resource%20Group.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20685px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F234126i774DDE8234905C6E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFind%26nbsp%3Bvalue%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20resourceGroupName%20%3D%20%24%7Bname%7D-%24%7Benvironment%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20change%20it%20to%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20resourceGroupName%20%3D%20%24%7Bname%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ein%20the%20file%20%3CSTRONG%3EprovisionComposer.js%3C%2FSTRONG%3E%20and%20save%2C%20with%20this%20change%2C%20it%20will%20not%20append%20the%20given%20Environment%20value%20to%20Resource%20Group%20name.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENow%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIn%26nbsp%3BprovisionComposer.js%26nbsp%3Bfile%2C%20%3CSTRONG%3Ereplace%26nbsp%3BcreateResourceGroup%3C%2FSTRONG%3E%20function%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFrom%20this..%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20createResourceGroup%20%3D%20async%20(client%2C%20location%2C%20resourceGroupName)%20%3D%26gt%3B%20%7B%20%0A%20%20logger(%7B%20%0A%20%20%20%20status%3A%20BotProjectDeployLoggerType.PROVISION_INFO%2C%20%0A%20%20%20%20message%3A%20%22%26gt%3B%20Creating%20resource%20group%20...%22%2C%0A%20%20%20%7D)%3B%20%0A%20%20%20const%20param%20%3D%20%7B%20%0A%20%20%20%20%20location%3A%20location%2C%20%7D%3B%20%0A%20%20%20return%20await%20client.resourceGroups.createOrUpdate(resourceGroupName%2C%20param)%3B%20%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20this...%20and%20Save!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20createResourceGroup%20%3D%20async%20(client%2C%20location%2C%20resourceGroupName)%20%3D%26gt%3B%20%7B%0A%20%20logger(%7B%0A%20%20%20%20status%3A%20BotProjectDeployLoggerType.PROVISION_INFO%2C%0A%20%20%20%20message%3A%20%60%26gt%3B%20getting%20resource%20group%20%24%7BresourceGroupName%7D...%60%2C%0A%20%20%7D)%3B%0A%20%20return%20await%20client.resourceGroups.get(resourceGroupName)%3B%20%20%20%20%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20we%20are%20using%26nbsp%3B%3CSTRONG%3Eclient.resourceGroups.get(resourceGroupName)%3C%2FSTRONG%3E%20-%26nbsp%3Bthis%20function%20returns%20the%20existing%20resource%20group%20values.%20check%20more%20about%20this%20function%20%3CA%20title%3D%22Resource%20Groups%20-%20Get%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fresources%2Fresourcegroups%2Fget%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1895337%22%20slang%3D%22en-US%22%3E%3CP%3EFollow%20the%20same%20steps%20mentioned%20here%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcomposer%2Fhow-to-publish-bot%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EPublish%20a%20bot%20to%20Azure%20-%20Bot%20Composer%20%7C%20Microsoft%20Docs%3C%2FA%3E%26nbsp%3BHowever%20to%20publish%20Azure%20Bot%20Framework%20Composer%20Bot%20to%20already%20existing%20Resource%20Group%2C%20follow%20below%20steps.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Follow the same steps mentioned here Publish a bot to Azure - Bot Composer | Microsoft Docs  However to publish Azure Bot Framework Composer Bot to already existing Resource Group, follow below steps. 

 

You can find the provisioning steps in the readme.md file which is automatically created when you create a new Bot in Bot Composer.  

 

Untitled picture.png

As of now, by default, provisioning script creates a new Resource Group appending environment value to it and does not deploy the services to an existing Resource Group.

 

image.png

Find value

 

 

 

 

const resourceGroupName = ${name}-${environment};

 

 

 

 

and change it to 

 

 

 

 

const resourceGroupName = ${name};

 

 

 

 

in the file provisionComposer.js and save, with this change, it will not append the given Environment value to Resource Group name. 

 

Now:

In provisionComposer.js file, replace createResourceGroup function


From this..

 

 

 

const createResourceGroup = async (client, location, resourceGroupName) => { 
  logger({ 
    status: BotProjectDeployLoggerType.PROVISION_INFO, 
    message: "> Creating resource group ...",
   }); 
   const param = { 
     location: location, }; 
   return await client.resourceGroups.createOrUpdate(resourceGroupName, param); 
};

 

 

 

To this... and Save!

 

 

const createResourceGroup = async (client, location, resourceGroupName) => {
  logger({
    status: BotProjectDeployLoggerType.PROVISION_INFO,
    message: `> getting resource group ${resourceGroupName}...`,
  });
  return await client.resourceGroups.get(resourceGroupName);    
};

 

 

Here we are using client.resourceGroups.get(resourceGroupName) - this function returns the existing resource group values. check more about this function here