Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.96k forks source link

az acs create fails on provisioning microsoft.network #1309

Closed SteveLasker closed 7 years ago

SteveLasker commented 7 years ago

attempting to create an acs instance through the az acs create cli does not properly register microsoft.network.

.ms/arm-debug for usage details. {
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "ProvisioningFailed",
        "message": "Provisioning of resource(s) for container service 'bikesharing360East' in resource group 'bikesharin
g-acs' failed with errors: Resource type: Microsoft.Network/networkSecurityGroups, name: dcos-master-nsg-B3FF3E21, id: /
subscriptions/c4ee2e2f-5fb8-4f65-9177-c383b79cad3d/resourceGroups/bikesharing-acs/providers/Microsoft.Network/networkSec
urityGroups/dcos-master-nsg-B3FF3E21, StatusCode: Conflict, StatusMessage: \\n {\r\n  \"error\": {\r\n    \"code\": \"Mi
ssingSubscriptionRegistration\",\r\n    \"message\": \"The subscription is not registered to use namespace 'Microsoft.Ne
twork'. See https://aka.ms/rps-not-found for how to register subscriptions.\"\r\n  }\r\n}\r\nResource type: Microsoft.Ne
twork/networkSecurityGroups, name: dcos-agent-private-nsg-B3FF3E21, id: /subscriptions/c4ee2e2f-5fb8-4f65-9177-c383b79ca
d3d/resourceGroups/bikesharing-acs/providers/Microsoft.Network/networkSecurityGroups/dcos-agent-private-nsg-B3FF3E21, St
atusCode: Conflict, StatusMessage: \\n {\r\n  \"error\": {\r\n    \"code\": \"MissingSubscriptionRegistration\",\r\n
\"message\": \"The subscription is not registered to use namespace 'Microsoft.Network'. See https://aka.ms/rps-not-found
 for how to register subscriptions.\"\r\n  }\r\n}\r\nResource type: Microsoft.Network/publicIPAddresses, name: dcos-agen
t-ip-bikesharing360eastagents-B3FF3E21, id: /subscriptions/c4ee2e2f-5fb8-4f65-9177-c383b79cad3d/resourceGroups/bikeshari
ng-acs/providers/Microsoft.Network/publicIPAddresses/dcos-agent-ip-bikesharing360eastagents-B3FF3E21, StatusCode: Confli
ct, StatusMessage: \\n {\r\n  \"error\": {\r\n    \"code\": \"MissingSubscriptionRegistration\",\r\n    \"message\": \"T
he subscription is not registered to use namespace 'Microsoft.Network'. See https://aka.ms/rps-not-found for how to regi
ster subscriptions.\"\r\n  }\r\n}\r\nResource type: Microsoft.Network/publicIPAddresses, name: dcos-master-ip-bikesharin
g360eastmgmt-B3FF3E21, id: /subscriptions/c4ee2e2f-5fb8-4f65-9177-c383b79cad3d/resourceGroups/bikesharing-acs/providers/
Microsoft.Network/publicIPAddresses/dcos-master-ip-bikesharing360eastmgmt-B3FF3E21, StatusCode: Conflict, StatusMessage:
 \\n {\r\n  \"error\": {\r\n    \"code\": \"MissingSubscriptionRegistration\",\r\n    \"message\": \"The subscription is
 not registered to use namespace 'Microsoft.Network'. See https://aka.ms/rps-not-found for how to register subscriptions
.\"\r\n  }\r\n}\r\nResource type: Microsoft.Network/networkSecurityGroups, name: dcos-agent-public-nsg-B3FF3E21, id: /su
bscriptions/c4ee2e2f-5fb8-4f65-9177-c383b79cad3d/resourceGroups/bikesharing-acs/providers/Microsoft.Network/networkSecur
ityGroups/dcos-agent-public-nsg-B3FF3E21, StatusCode: Conflict, StatusMessage: \\n {\r\n  \"error\": {\r\n    \"code\":
\"MissingSubscriptionRegistration\",\r\n    \"message\": \"The subscription is not registered to use namespace 'Microsof
t.Network'. See https://aka.ms/rps-not-found for how to register subscriptions.\"\r\n  }\r\n}\r\nResource type: Microsof
t.Compute/availabilitySets, name: dcos-master-availabilitySet-B3FF3E21, id: /subscriptions/c4ee2e2f-5fb8-4f65-9177-c383b
79cad3d/resourceGroups/bikesharing-acs/providers/Microsoft.Compute/availabilitySets/dcos-master-availabilitySet-B3FF3E21
, StatusCode: Conflict, StatusMessage: \\n {\r\n  \"error\": {\r\n    \"code\": \"MissingSubscriptionRegistration\",\r\n
    \"message\": \"The subscription is not registered to use namespace 'Microsoft.Compute'. See https://aka.ms/rps-not-f
ound for how to register subscriptions.\"\r\n  }\r\n}\r\n"
      }
    ] 

However, using the portal to provision acs does the proper registrations.

Expected: az acs create does the same steps as the portal arm template for registering Microsoft.Networking and any other resources required.

SorraTheOrc commented 7 years ago

For clarity, this only occurs with a subscription that had not used ARM before.

jdumars commented 7 years ago

You need to register services in order to use them. This should get you there:

az provider register --namespace Microsoft.Network
az provider register --namespace Microsoft.Compute
az provider register --namespace Microsoft.Storage
brendandburns commented 7 years ago

We should probably automatically do this in the CLI. I'll take that on.

SteveLasker commented 7 years ago

Agreed @brendanburns. Do we really want developers having to enable/disable resources? When provisioning with an arm template, these are handled automatically. I'm sure there's some reason why this prinitive exists, but I don't believe there's value in making it that much more complicated for them to use our services.

brendandburns commented 7 years ago

@SteveLasker agreed, I think the CLI should auto-register for users for ACS. For the general case, we can talk about why it is this way in person sometime.

mariocannistra commented 6 years ago

Hello I entered these commands per instructions above

az provider register --namespace Microsoft.Network
az provider register --namespace Microsoft.Compute
az provider register --namespace Microsoft.Storage

and then tried again creating the cluster (hiding private info):

az acs create --name myacscluster --resource-group myresgroup --generate-ssh-keys --orchestrator-type kubernetes

but got the following error:

Deployment failed. Correlation ID: 2096add4-bc89-4857-842e-40b2b1898dc4. { "status": "Failed", "error": { "code": "ResourceDeploymentFailure", "message": "The resource operation completed with terminal provisioning state 'Failed'.", "details": [ { "code": "InvalidResourceReference", "message": "Provisioning of resource(s) for container service 'myacscluster' in resource group 'myresgroup' failed with errors: Resource type: Microsoft.Network/virtualNetworks, name: k8s-vnet-A7456B9, id: /subscriptions/mysubguid/resourceGroups/myresgroup/providers/Microsoft.Network/virtualNetworks/k8s-vnet-A7456B9, StatusCode: BadRequest, StatusMessage: \n {\r\n \"error\": {\r\n \"code\": \"InvalidResourceReference\",\r\n \"message\": \"Resource /subscriptions/mysubguid/resourceGroups/myresgroup/providers/Microsoft.Network/networkSecurityGroups/K8S-MASTER-A7456B9-NSG referenced by resource /subscriptions/mysubguid/resourceGroups/myresgroup/providers/Microsoft.Network/virtualNetworks/k8s-vnet-A7456B9 was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.\",\r\n \"details\": [\r\n {\r\n \"code\": \"NotFound\",\r\n \"message\": \"Resource /subscriptions/mysubguid/resourceGroups/myresgroup/providers/Microsoft.Network/networkSecurityGroups/K8S-MASTER-A7456B9-NSG not found.\"\r\n }\r\n ]\r\n }\r\n}\r\n" } ] } }

Could you please advise on how to solve this? I'm using azure cli version 2.0.32-1~artful on Ubuntu.