Hi Facing issues with Azure playground

Hi ,

I created a simple Bicep storage resource in Visual studio and I would like to deploy it to Azure portal. Then Microsoft window popped up asking for login credentials. I gave Azure playground credentials .I selected Kode Kloud subscription and existing Resource group. When I executed it . It is not Deploying. Tried a few times. Please help me. and also Please let what credentials I need to give in Azure cli in order to create Azure resources using Terraform. If I cannot create another resource group. Can I deploy in the existing resource group.

I’m assuming you’re trying to hook up VSCode to our playground, which should work, although I’m not really set up to test that. But I don’t see a problem with using the Azure playground per se. I fired up a playground instance and did the following in the Azure code shell as “res.bicep”, based on an Azure tutorial:

param location string = resourceGroup().location
param storageAccountName string = 'toylaunch${uniqueString(resourceGroup().id)}'

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: storageAccountName
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
  properties: {
    accessTier: 'Hot'
  }
}

Using the playground’s default resource group (from az group list), I called this file as

az deployment group create --resource-group kml_rg_main-FROM-GROUP-LIST --template-file res.bicep

This worked; the storage account was created.

You do need to have the permissions to create whatever object you described in your Bicep code, but in general, it should work.

Thanks Rob. It worked if I did exactly the way you mentioned. But not working when I am using visual studio right click window option Deploy Bicep file. It says no subscription. I also need some help with creating Azure resources with Terraform. Is there any time window that we can share our screen and resolve issues. Please let me know. Thanks much for the Kodekloud Team.

I expect that the problem here is syncing your VSCode session with the playground. I just tried, and succeeded with the playground using this tutorial.. Steps are:

  1. Make sure you have the Azure extensions installed in VSCode.
  2. Create a playground session and log in using the credentials you get from us.
  3. In VSCode, when you do the " Sign in to your Azure account with Azure Tools" step of the tutorial, choose the same “IAM_username” you used to create your Azure session in the PG.
  4. Make sure you have the Azure extension for Bicep.
  5. Open your Bicep code in VSCode.
  6. Now use the context menu and select “Deploy Bicep File…”. It will ask for the subscription and resource group (it will be able to give you good defaults for these for the PG), and will deploy the file.

This worked for me using the same code I used before:

1:52:23 PM: ====================
1:52:23 PM: Preparing for deployment of /Users/xxxxxxx/projects/azure/vscode-test/restest.bicep
1:52:23 PM: Scope specified in restest.bicep: resourceGroup
1:53:12 PM: No parameter file was provided
1:53:16 PM: Deployment started for /Users/xxxxxxxx/projects/azure/vscode-test/restest.bicep.
1:53:16 PM: Open deployment in portal: https://portal.azure.com/#blade/HubsExtension/DeploymentDetailsBlade/overview/id/%2FsubscriptionsTHE-PLAYGROUND-SUBSCRIPTION
1:53:16 PM: Waiting for deployment to complete
1:53:52 PM: Deployment succeeded for /Users/xxxxxxxx/projects/azure/vscode-test/restest.bicep.