az sf cluster create fails when providing a pfx file with AttributeError: 'NoneType' object has no attribute 'get'
Describe the bug
When using an existing key vault and certificate the az sf cluster create command fails with AttributeError: 'NoneType' object has no attribute 'get'. Please find the stack trace below:
ERROR: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\knack\knack\cli.py", line 197, in invoke
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 373, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\six\six.py", line 693, in reraise
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 347, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 182, in __call__
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\__init__.py", line 440, in default_command_handler
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-servicefabric\azure\cli\command_modules\servicefabric\custom.py", line 204, in new_cluster
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-servicefabric\azure\cli\command_modules\servicefabric\custom.py", line 1119, in _create_certificate
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-servicefabric\azure\cli\command_modules\servicefabric\custom.py", line 1635, in _create_keyvault
AttributeError: 'NoneType' object has no attribute 'get'
To Reproduce
- Create a ResourceGroup named "MyServiceFabric" and Key Vault in that ResourceGroup named "MyServiceFabric-SF-Keyvault"
- Add a certificate to the KeyVault named "MyServiceFabric" with the subject set to "CN=MyServiceFabric.southcentralus.cloudapp.azure.com"
- Execute the following Powershell script
# Variables
$ResourceGroupName="MyServiceFabric"
$ClusterName= "$ResourceGroupName".Replace('.','')
$Location="southcentralus"
$Subject="$ClusterName.$Location.cloudapp.azure.com"
$VaultName="$ClusterName-SF-Keyvault"
# #GetKeys From the KeyVault
$VmPassword = "VmPassword"
$VmUserName = "VmUserName"
az keyvault secret download --encoding base64 --vault-name $VaultName --name $ClusterName --file cert.pfx
az sf cluster create --location $Location --resource-group $ResourceGroupName --certificate-file ./cert.pfx `
--cluster-name $ClusterName --cluster-size 5 --os WindowsServer2016Datacenter --vault-name $VaultName `
--vm-password $VmPassword --vm-user-name $VmUserName --debug
Expected behavior Existing Key Vault and provided certificate is used and the service fabric cluster is created or a clear error message is displayed with a description on how to resolve the issue
Environment summary Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) MSI
CLI version (az --version)
azure-cli (2.0.50)
acr (2.1.8)
acs (2.3.11)
advisor (2.0.0)
ams (0.3.0)
appservice (0.2.6)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.19)
consumption (0.4.0)
container (0.3.8)
core (2.0.50)
cosmosdb (0.2.3)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.1)
extension (0.2.3)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.4.0)
iot (0.3.4)
iotcentral (0.1.3)
keyvault (2.2.6)
lab (0.1.3)
maps (0.3.2)
monitor (0.2.6)
network (2.2.8)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.2)
rdbms (0.3.4)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.6)
role (2.1.9)
search (0.1.1)
servicebus (0.3.2)
servicefabric (0.1.7)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.4)
telemetry (1.0.0)
vm (2.2.7)
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\akrone\.azure\cliextensions'
Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]
OS version Windows 10 64-bit (10.0 Build 16299)
Shell Type (e.g. bash, cmd.exe, Bash on Windows)
PowerShell
Additional context Add any other context about the problem here.
I am running into the same issue, but with parameters set to generate a cert rather than supplying one that already exists. In fact I was just following a tutorial... https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-quickstart-containers-linux
Thanks for the feedback. @a-santamaria is currently investigating.