Does this cleanup command in the training need to be adjusted to the below?

David Elmquist 0 Reputation points Microsoft Employee
2024-06-02T09:59:28.51+00:00

Following the training below I get the following error message:

(MissingSubscription) The request did not have a subscription or a valid tenant level resource provider.

Code: MissingSubscription Message: The request did not have a subscription or a valid tenant level resource provider.

It appears that you may need to add a second '/' in the scope parameter for this to work? (see bold below)

https://learn.microsoft.com/en-us/training/modules/deploy-resources-scopes-bicep/4-exercise-deploy-subscription-scoped-resource?pivots=cli

subscriptionId=$(az account show --query 'id' --output tsv)

az policy assignment delete --name 'DenyFandGSeriesVMs' --scope "//subscriptions/$subscriptionId"

az policy definition delete --name 'DenyFandGSeriesVMs' --subscription $subscriptionId

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,701 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rakesh Gurram 9,065 Reputation points Microsoft Vendor
    2024-07-16T10:42:23.6466667+00:00

    Hi David Elmquist,

    Thank you for your patience.

    We have consulted with our internal team and received confirmation that the instructions provided in the document are typically intended for use within the Azure Cloud Shell environment.

    Upon executing the commands outlined in the "Clean up the resources" section of the "Exercise - Deploy a subscription-scoped resource" in both Azure Cloud Shell (Bash and PowerShell environments), we successfully deleted the resources without encountering any error messages, following the document's instructions.

    It's important to note that in the Azure Cloud Shell environment, the additional '/' in the scope parameter is unnecessary. If a second '/' appears, it may be due to quoting differences between environments.

    Attached below are screenshots from the Azure Cloud Shell environment for your reference, demonstrating the use of a single '/' in the scope parameter:

    Power Shell environment:

    PowerShell

    Bash environment:

    CLI

    If you continue to experience any issues, please inform us in the comments. We are dedicated to assisting you further.

    If you find this information helpful, please indicate your acknowledgment by clicking the Upvote and Accept Answer buttons on the post.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.