Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to retrieve azure service principal password using azure sdk for python #2052

Closed
tapatel opened this issue Jun 25, 2020 · 5 comments

Comments

@tapatel
Copy link

tapatel commented Jun 25, 2020

Is there a way to retrieve azure service principal password using azure sdk for python? I am creating service principal using following but service principal create response has empty password.

def create_azure_service_principal(self, app_name=None):

    app = self.graphrbac_client.applications.create({
        'available_to_other_tenants': False,
        'display_name': app_name,
        'identifier_uris': [f'http://{app_name}'],
        'app_roles': []
    })

    sp = self.graphrbac_client.service_principals.create({
        'app_id': app.app_id,
        'account_enabled': True
    })
    return sp

Here is the response :

{
'additional_properties': {
'odata.type': 'Microsoft.DirectoryServices.ServicePrincipal',
'signInAudience': 'AzureADMyOrg',
'preferredSingleSignOnMode': None,
'preferredTokenSigningKeyEndDateTime': None,
'samlSingleSignOnSettings': None,
'applicationTemplateId': None,
'notificationEmailAddresses': [],
'addIns': [],
'tokenEncryptionKeyId': None,
'informationalUrls': {
'termsOfService': None,
'support': None,
'privacy': None,
'marketing': None
},
'odata.metadata': 'https://graph.windows.net/<tenant_id>/$metadata#directoryObjects/@element'
},
'object_id': '<object_id>',
'deletion_timestamp': None,
'object_type': 'ServicePrincipal',
'account_enabled': True,
'alternative_names': [],
'app_display_name': 'my-test',
'app_id': '<app_id>',
'app_owner_tenant_id': '<tenant_id>',
'app_role_assignment_required': False,
'app_roles': [],
'display_name': 'my-test',
'error_url': None,
'homepage': None,
'key_credentials': [],
'logout_url': None,
'oauth2_permissions': [ < azure.graphrbac.models.oauth2_permission_py3.OAuth2Permission object at 0x7f64567b67810 > ],
'password_credentials': [],
'preferred_token_signing_key_thumbprint': None,
'publisher_name': 'Default Directory',
'reply_urls': [],
'saml_metadata_url': None,
'service_principal_names': ['<app_id>'],
'service_principal_type': 'Application',
'tags': []
}

Is there a way to reset the service principal using python sdk?

Not : I know we can this using azure cli but not sure if i want to mix azure sdk and cli in my code.

Please advice...


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@MonikaReddy-MSFT
Copy link
Contributor

@tapatel - Thanks for brining this to our attention. We will investigate it further and update you shortly.

@MonikaReddy-MSFT
Copy link
Contributor

@tapatel - Thanks for bringing this to out attention.
This question belongs to Azure SDK For Python, hence I have moved this to the right repo to get the better visibility for your question.
Since there are no doc updates for this doc at the moment, We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

@tapatel
Copy link
Author

tapatel commented Jun 29, 2020

@MonikaReddy-MSFT : Thank you...Can you please send me the github issue link you open for Azure sdk?

@MonikaReddy-MSFT
Copy link
Contributor

@tapatel - Its linked above. But here is the link - Azure/azure-sdk-for-python#12246

@tapatel
Copy link
Author

tapatel commented Jun 29, 2020

@MonikaReddy-MSFT Thank you...Got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants