0

I try to create a system-topic. To do it, I'm using the eventgrid extension that is in preview.

az eventgrid system-topic create \
    --name $topicName \
    --resource-group $resourceGroupName \
    --location $location \
    --topic-type microsoft.storage.storageaccounts \
    --source $storageId

But if I try to get the id/endpoint/key on this way:

echo "Landing Topic Information:"
topicId=$(az eventgrid topic show \
  --name $topicName \
  --resource-group $resourceGroupName \
  --query id \
  --output tsv)
echo "Topic Id: $topicId"

topicEndpoint=$(az eventgrid topic show \
  --name $topicName \
  --resource-group $resourceGroupName \
  --query endpoint \
  --output tsv)
echo "Topic Endpoint: $topicEndpoint"

topicKey=$(az eventgrid topic key list \
  --name $topicName \
  --resource-group $resourceGroupName \
  --query key1 \
  --output tsv)
echo "Topic Key: $topicKey"

I get an error:

Landing Topic Information:
The behavior of this command has been altered by the following extension: eventgrid
The Resource 'Microsoft.EventGrid/topics/xxx' under resource group 'xxxxxx-grp' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Topic Id: 
The behavior of this command has been altered by the following extension: eventgrid
The Resource 'Microsoft.EventGrid/topics/xxx' under resource group 'xxxxxx-grp' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Topic Endpoint: 
The behavior of this command has been altered by the following extension: eventgrid
The Resource 'Microsoft.EventGrid/topics/xxx' under resource group 'xxxxxx-grp' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Topic Key: 

I can see the system-topic using the Portal

Looking at the result, I prefer don't use extensions, so the question is: How to create a system-topic using the CLI without extension?*

CLI:

$ az --version
azure-cli                          2.7.0

command-modules-nspkg              2.0.3
core                               2.7.0
nspkg                              3.0.4
telemetry                          1.0.4

Extensions:
eventgrid                          0.4.9
interactive                        0.4.4

Python location '/opt/az/bin/python3'
Extensions directory '/home/angelcc/.azure/cliextensions'

Python (Linux) 3.6.10 (default, May 29 2020, 08:10:59) 
[GCC 9.3.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

References:

2 Answers 2

2

System topics are built-in topics provided by Azure services. You don't see system topics in your Azure subscription because the publisher owns the topics, but you can subscribe to them. To subscribe, you provide information about the resource you want to receive events from. As long as you have access to the resource, you can subscribe to its events.

The documentation is clear on this: system topics exist for Azure Services. They are not created, only subscribed to. You can create a custom topics. There are also partner topics that can be created. Event Domains creates topics on your behalf, no need to create those, and those topics mostly serve for partitioning.

Update 2020-06-10: Microsoft has introduced a way to define a system topic explicitly rather than using auto-generated topics that are hidden. It supposed to help with not just discoverability but also aligns better with the overall Azure resources experience.

It should be possible to create system topics with Azure CLI. It will require EventGrid ARM extension to be installed using az extension add -n eventgrid. If it was installed earlier it would need to be updated using az extension update -n eventgrid. The documentation should be updated to add this nuance.

Sign up to request clarification or add additional context in comments.

4 Comments

I don't understand that. System topics are build-in, but as you can read in the System topics documentation, one of the two ways that describe is creating the topic manually and then create subscriptions. As the documentation mention, If you don't create the topic manually, it will be removed automatically after the last subscription is gone.
You can read more about how to create system-topics in the Create, view, and manage Event Grid system topics using Azure CLI. The problem is that it does not work with out the extension, even when the documentation is not related to any extension. :)
It makes sense that the event grid resource provider extension would be required. I'd expect to see that as a prerequisite in the article. I'd have to review this.
I created a ticket. I think that it is important to say that it is a CLI preview feature, event when it is an option in the Portal. github.com/MicrosoftDocs/azure-docs/issues/56777
0

It looks like at the moment, it is possible to create system-topic manually only via eventgrid extension.

The documentation about it is not clear on that point: I created an issue to fix it

The reason because of the list of errors:

  • I was using the wrong command to get the information: az eventgrid topic show should be az eventgrid system-topic show.
  • System topics do not have endpoint because only the system resource can publish messages there.
  • System topics do not have keys because only the system resource can publish messages there.

2 Comments

this new preview features are available using the REST APIs (which is used for underlying of az eventgrid) see more details learn.microsoft.com/en-us/rest/api/eventgrid/…, so for example, using the az rest --method get --url "management.azure.com/subscriptions/xxxx/resourceGroups/myRG/…" we can get the list of all systemTopics in the resource group myRG
I've updated my answer. Microsoft is working on updating the article. Wish it would not just show up but also be announced properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.